private ColumnFamily processModifications ( ColumnFamily changesCF ) { ColumnFamilyStore cfs = Keyspace . open ( getKeyspaceName ( ) ) . getColumnFamilyStore ( changesCF . id ( ) ) ; ColumnFamily resultCF = changesCF . cloneMeShallow ( ) ; List < CounterUpdateCell > counterUpdateCells = new ArrayList <> ( changesCF . getColumnCount ( ) ) ; for ( Cell cell : changesCF ) { if ( cell instanceof CounterUpdateCell ) counterUpdateCells . add ( ( CounterUpdateCell ) cell ) ; else resultCF . addColumn ( cell ) ; } if ( counterUpdateCells . isEmpty ( ) ) return resultCF ; // only DELETEs ClockAndCount [ ] currentValues = getCurrentValues ( counterUpdateCells , cfs ) ; for ( int i = 0 ; i < counterUpdateCells . size ( ) ; i ++ ) { ClockAndCount currentValue = currentValues [ i ] ; CounterUpdateCell update = counterUpdateCells . get ( i ) ; long clock = currentValue . clock + 1L ; long count = currentValue . count + update . delta ( ) ; resultCF . addColumn ( new BufferCounterCell ( update . name ( ) , CounterContext . instance ( ) . createGlobal ( CounterId . getLocalId ( ) , clock , count ) , update . timestamp ( ) ) ) ; } return resultCF ; }
Replaces all the CounterUpdateCell - s with updated regular CounterCell - s