Search in sources :

Example 1 with Builder

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

the class HotspottyDataStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    HotspottyDataStreamMetadataTable metaTable = tables.getHotspottyDataStreamMetadataTable(t);
    HotspottyDataStreamMetadataTable.HotspottyDataStreamMetadataRow row = HotspottyDataStreamMetadataTable.HotspottyDataStreamMetadataRow.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 2 with Builder

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

the class TestHashComponentsStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    TestHashComponentsStreamMetadataTable metaTable = tables.getTestHashComponentsStreamMetadataTable(t);
    TestHashComponentsStreamMetadataTable.TestHashComponentsStreamMetadataRow row = TestHashComponentsStreamMetadataTable.TestHashComponentsStreamMetadataRow.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 3 with Builder

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

the class StreamTestWithHashStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    StreamTestWithHashStreamMetadataTable metaTable = tables.getStreamTestWithHashStreamMetadataTable(t);
    StreamTestWithHashStreamMetadataTable.StreamTestWithHashStreamMetadataRow row = StreamTestWithHashStreamMetadataTable.StreamTestWithHashStreamMetadataRow.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 4 with Builder

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

the class UserPhotosStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    UserPhotosStreamMetadataTable metaTable = tables.getUserPhotosStreamMetadataTable(t);
    UserPhotosStreamMetadataTable.UserPhotosStreamMetadataRow row = UserPhotosStreamMetadataTable.UserPhotosStreamMetadataRow.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 5 with Builder

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

the class ValueStreamStore method touchMetadataWhileStoringForConflicts.

private void touchMetadataWhileStoringForConflicts(Transaction t, Long id, long blockNumber) {
    ValueStreamMetadataTable metaTable = tables.getValueStreamMetadataTable(t);
    ValueStreamMetadataTable.ValueStreamMetadataRow row = ValueStreamMetadataTable.ValueStreamMetadataRow.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: " + 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