Search in sources :

Example 6 with Builder

use of com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder in project atlasdb by palantir.

the class DataStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    DataStreamMetadataTable metaTable = tables.getDataStreamMetadataTable(t);
    DataStreamMetadataTable.DataStreamMetadataRow row = DataStreamMetadataTable.DataStreamMetadataRow.of(id);
    StreamMetadata metadata = metaTable.getMetadatas(ImmutableSet.of(row)).values().iterator().next();
    Preconditions.checkState(metadata.getStatus() == Status.STORING, "This stream is being cleaned up while storing blocks: %s", id);
    Builder builder = StreamMetadata.newBuilder(metadata);
    builder.setLength(blockNumber * BLOCK_SIZE_IN_BYTES + 1);
    metaTable.putMetadata(row, builder.build());
}
Also used : StreamMetadata(com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata) Builder(com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder)

Example 7 with Builder

use of com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder in project atlasdb by palantir.

the class StreamTestMaxMemStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    StreamTestMaxMemStreamMetadataTable metaTable = tables.getStreamTestMaxMemStreamMetadataTable(t);
    StreamTestMaxMemStreamMetadataTable.StreamTestMaxMemStreamMetadataRow row = StreamTestMaxMemStreamMetadataTable.StreamTestMaxMemStreamMetadataRow.of(id);
    StreamMetadata metadata = metaTable.getMetadatas(ImmutableSet.of(row)).values().iterator().next();
    Preconditions.checkState(metadata.getStatus() == Status.STORING, "This stream is being cleaned up while storing blocks: %s", id);
    Builder builder = StreamMetadata.newBuilder(metadata);
    builder.setLength(blockNumber * BLOCK_SIZE_IN_BYTES + 1);
    metaTable.putMetadata(row, builder.build());
}
Also used : StreamMetadata(com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata) Builder(com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder)

Example 8 with Builder

use of com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder in project atlasdb by palantir.

the class StreamTestStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    StreamTestStreamMetadataTable metaTable = tables.getStreamTestStreamMetadataTable(t);
    StreamTestStreamMetadataTable.StreamTestStreamMetadataRow row = StreamTestStreamMetadataTable.StreamTestStreamMetadataRow.of(id);
    StreamMetadata metadata = metaTable.getMetadatas(ImmutableSet.of(row)).values().iterator().next();
    Preconditions.checkState(metadata.getStatus() == Status.STORING, "This stream is being cleaned up while storing blocks: %s", id);
    Builder builder = StreamMetadata.newBuilder(metadata);
    builder.setLength(blockNumber * BLOCK_SIZE_IN_BYTES + 1);
    metaTable.putMetadata(row, builder.build());
}
Also used : StreamMetadata(com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata) Builder(com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder)

Aggregations

StreamMetadata (com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata)8 Builder (com.palantir.atlasdb.protos.generated.StreamPersistence.StreamMetadata.Builder)8