/** * Remove the edge * * @param scope The scope * @param rowKeyId The id to use in the row key * @param edgeType The edge type * @param version The version of the edge * @param cf The column family */ private MutationBatch removeEdgeType( final ApplicationScope scope, final Id rowKeyId, final String edgeType, final long version, final MultiTenantColumnFamily<BucketScopedRowKey<Id>, String> cf ) { //write target<--source edge type meta data final int currentShard = idExpandingShardLocator.getCurrentBucket( rowKeyId ); final BucketScopedRowKey<Id> rowKey = BucketScopedRowKey.fromKey( scope.getApplication(), rowKeyId, currentShard ); final MutationBatch batch = keyspace.prepareMutationBatch().withTimestamp( version ); batch.withRow( cf, rowKey ).deleteColumn( edgeType ); return batch; }
/** * Remove the id type * * @param scope The scope to use * @param rowId The id to use in the row key * @param idType The id type to use in the column * @param edgeType The edge type to use in the column * @param version The version to use on the column * @param cf The column family to use * * @return A populated mutation with the remove operations */ private MutationBatch removeIdType( final ApplicationScope scope, final Id rowId, final String idType, final String edgeType, final long version, final MultiTenantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> cf ) { final EdgeIdTypeKey edgeIdTypeKey = new EdgeIdTypeKey( rowId, edgeType ); final int currentShard = edgeTypeExpandingShardLocator.getCurrentBucket( edgeIdTypeKey ); final MutationBatch batch = keyspace.prepareMutationBatch().withTimestamp( version ); //write target<--source edge type and id type to meta data final BucketScopedRowKey<EdgeIdTypeKey> rowKey = BucketScopedRowKey.fromKey( scope.getApplication(), edgeIdTypeKey, currentShard ); batch.withRow( cf, rowKey ).deleteColumn( idType ); return batch; }
final BucketScopedRowKey<Id> sourceKey = BucketScopedRowKey.fromKey( scopeId, source, sourceKeyBucket ); BucketScopedRowKey.fromKey( scopeId, sourceTargetTypeKey, sourceTargetTypeBucket ); final BucketScopedRowKey<Id> targetKey = BucketScopedRowKey.fromKey( scopeId, target, targetKeyBucket ); BucketScopedRowKey.fromKey( scopeId, targetSourceTypeKey, targetSourceTypeKeyBucket );