@Override public MutationBatch writeShardMeta( final ApplicationScope scope, final Shard shard, final DirectedEdgeMeta metaData) { ValidationUtils.validateApplicationScope( scope ); GraphValidation.validateDirectedEdgeMeta( metaData ); Preconditions.checkNotNull( metaData, "metadata must be present" ); Preconditions.checkNotNull( shard ); Preconditions.checkArgument( shard.getShardIndex() > -1, "shardid must be greater than -1" ); Preconditions.checkArgument( shard.getCreatedTime() > -1, "createdTime must be greater than -1" ); final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope.getApplication(), metaData ); final MutationBatch batch = keyspace.prepareMutationBatch(); // write the row with a current timestamp so we can ensure that it's persisted with updated shard meta long batchTimestamp = System.currentTimeMillis(); batch.withTimestamp( batchTimestamp ).withRow( EDGE_SHARDS, rowKey ) .putColumn( shard.getShardIndex(), SHARD_SERIALIZER.toByteBuffer(shard)).setTimestamp(batchTimestamp); return batch; }
/** * Do the write on the correct row for the entity id with the operation */ private MutationBatch doWrite( final ApplicationScope applicationScope, final Id entityId, final UUID version, final RowOp op ) { final MutationBatch batch = keyspace.prepareMutationBatch(); final Id applicationId = applicationScope.getApplication(); final ScopedRowKey<Id> rowKey = ScopedRowKey.fromKey( applicationId, entityId ); final long timestamp = version.timestamp(); op.doOp( batch.withRow( CF_ENTITY_DATA, rowKey ).setTimestamp( timestamp ) ); return batch; }
dels.setTimestamp(commitTime.getDeletionTime(times)); upds.setTimestamp(commitTime.getAdditionTime(times));
@Override public MutationBatch removeShardMeta( final ApplicationScope scope, final Shard shard, final DirectedEdgeMeta metaData) { ValidationUtils.validateApplicationScope( scope ); GraphValidation.valiateShard( shard ); GraphValidation.validateDirectedEdgeMeta( metaData ); final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope.getApplication(), metaData ); final MutationBatch batch = keyspace.prepareMutationBatch(); // write the row with a current timestamp so we can ensure that it's persisted with updated shard meta long batchTimestamp = System.currentTimeMillis(); batch.withTimestamp(batchTimestamp).withRow( EDGE_SHARDS, rowKey ) .deleteColumn( shard.getShardIndex() ).setTimestamp(batchTimestamp); return batch; }
@Override public MutationBatch mark( final ApplicationScope scope, final Id node, final long timestamp ) { ValidationUtils.validateApplicationScope( scope ); ValidationUtils.verifyIdentity( node ); GraphValidation.validateTimestamp( timestamp, "timestamp" ); MutationBatch batch = keyspace.prepareMutationBatch().withConsistencyLevel( fig.getWriteCL() ); batch.withRow( GRAPH_DELETE, ScopedRowKey.fromKey( scope.getApplication(), node ) ).setTimestamp( timestamp ) .putColumn( COLUMN_NAME, timestamp ); return batch; }
@Override public MutationBatch delete( final ApplicationScope scope, final Id node, final long timestamp ) { ValidationUtils.validateApplicationScope( scope ); ValidationUtils.verifyIdentity( node ); GraphValidation.validateTimestamp( timestamp, "timestamp" ); MutationBatch batch = keyspace.prepareMutationBatch().withConsistencyLevel( fig.getWriteCL() ); batch.withRow( GRAPH_DELETE, ScopedRowKey.fromKey( scope.getApplication(), node ) ).setTimestamp( timestamp ) .deleteColumn( COLUMN_NAME ); return batch; }
batch.withRow( testCf, key ).setTimestamp( firstUUID.timestamp() ).putColumn( colname, colvalue ); batch.withRow( testCf, key ).setTimestamp( firstUUID.timestamp() ).putColumn( colname, colvalue ); batch.withRow( testCf, key ).setTimestamp( firstUUID.timestamp() ).deleteColumn( colname ); batch.execute(); batch.withRow( testCf, key ).setTimestamp( secondUUID.timestamp() ).putColumn( colname, colvalue ); batch.execute(); batch.withRow( testCf, key ).setTimestamp( firstUUID.timestamp() ).deleteColumn( colname ); batch.execute(); batch.withRow( testCf, key ).setTimestamp( thirdUUID.timestamp() ).deleteColumn( colname ); batch.execute();
@Override public ColumnListMutation<C> setTimestamp(long timestamp) { primary.setTimestamp(timestamp); secondary.setTimestamp(timestamp); return this; }
/** * Copies columns exactly, preserving Cassandra timestamp and ttl values. */ private <C> void putAll(ColumnListMutation<C> mutation, Iterable<Column<C>> columns) { for (Column<C> column : columns) { mutation.setTimestamp(column.getTimestamp()) .putColumn(column.getName(), column.getByteBufferValue(), column.getTtl()); } }
/** * Copies columns exactly, preserving Cassandra timestamp and ttl values. */ private <C> void putAll(ColumnListMutation<C> mutation, Iterable<Column<C>> columns) { for (Column<C> column : columns) { mutation.setTimestamp(column.getTimestamp()) .putColumn(column.getName(), column.getByteBufferValue(), column.getTtl()); } }
/** * Copies columns exactly, preserving Cassandra timestamp and ttl values. */ private <C> void putAll(ColumnListMutation<C> mutation, Iterable<Column<C>> columns) { for (Column<C> column : columns) { mutation.setTimestamp(column.getTimestamp()) .putColumn(column.getName(), column.getByteBufferValue(), column.getTtl()); } }
/** * Copies columns exactly, preserving Cassandra timestamp and ttl values. */ private <C> void putAll(ColumnListMutation<C> mutation, Iterable<Column<C>> columns) { for (Column<C> column : columns) { mutation.setTimestamp(column.getTimestamp()) .putColumn(column.getName(), column.getByteBufferValue(), column.getTtl()); } }
context.mb.lockCurrentTimestamp(); for (Column<C> column : row.getColumns()) { mbRow.setTimestamp(column.getTimestamp()); mbRow.putColumn(column.getName(), column.getByteBufferValue(), column.getTtl());
context.mb.lockCurrentTimestamp(); for (Column<C> column : row.getColumns()) { mbRow.setTimestamp(column.getTimestamp()); mbRow.putColumn(column.getName(), column.getByteBufferValue(), column.getTtl());
dels.setTimestamp(commitTime.getDeletionTime(times)); upds.setTimestamp(commitTime.getAdditionTime(times));
dels.setTimestamp(commitTime.getDeletionTime(times.getUnit())); upds.setTimestamp(commitTime.getAdditionTime(times.getUnit()));
.setTimestamp(1).putColumn(1L, 1L) .setTimestamp(10).putColumn(2L, 2L) .setTimestamp(result1.getColumnByName(1L).getTimestamp()-1) .deleteColumn(1L) .setTimestamp(result1.getColumnByName(2L).getTimestamp()-1) .deleteColumn(2L) .putEmptyColumn(3L, null); .setTimestamp(result1.getColumnByName(1L).getTimestamp()+1) .deleteColumn(1L) .setTimestamp(result1.getColumnByName(2L).getTimestamp()+1) .deleteColumn(2L); mb.execute();
.setTimestamp(column.getTimestamp()) .putColumn(name, column.getByteBufferValue(), column.getTtl()); .setTimestamp(chunk.getTimestamp()) .putEmptyColumn(getColumn(ColumnGroup.B, chunkId), chunk.getTtl()) .putColumn(getColumn(ColumnGroup.Z, chunkId), chunk.getByteBufferValue(), chunk.getTtl());