question: private int findCheckpointPosition ( int [ ] cids ) { if ( checkpointPeriod < 1 ) { return - 1 ; } if ( cids . length == 0 ) { throw new IllegalArgumentException ( ) ; } int firstCID = cids [ 0 ] ; if ( ( firstCID + 1 ) % checkpointPeriod == 0 ) { return cidPosition ( cids , firstCID ) ; } else { int nextCkpIndex = ( ( ( firstCID / checkpointPeriod ) + 1 ) * checkpointPeriod ) - 1 ; if ( nextCkpIndex <= cids [ cids . length - 1 ] ) { return cidPosition ( cids , nextCkpIndex ) ; } } return - 1 ; }
target:  Iterates over the commands to find if the replica took a checkpoint. This iteration over commands is needed due to the batch execution strategy introduced with the durable techniques to improve state management. As several consensus instances can be executed in the same batch of commands, it is necessary to identify if the batch contains checkpoint indexes.