use of io.pravega.controller.store.stream.records.TagRecord in project pravega by pravega.
the class PravegaTablesScope method removeStreamFromEntry.
private TableSegmentEntry removeStreamFromEntry(String tag, String removeValue, TableSegmentEntry currentEntry) {
byte[] array = storeHelper.getArray(currentEntry.getValue());
byte[] updatedBytes = new byte[0];
if (array.length != 0) {
TagRecord record = TagRecord.fromBytes(array);
// Remove Stream from TagRecord.
TagRecord updatedRecord = record.toBuilder().removeStream(removeValue).build();
updatedBytes = updatedRecord.toBytes();
}
return TableSegmentEntry.versioned(tag.getBytes(StandardCharsets.UTF_8), updatedBytes, currentEntry.getKey().getVersion().getSegmentVersion());
}
use of io.pravega.controller.store.stream.records.TagRecord in project pravega by pravega.
the class PravegaTablesScope method appendStreamToEntry.
private TableSegmentEntry appendStreamToEntry(String tag, String appendValue, TableSegmentEntry entry) {
byte[] array = storeHelper.getArray(entry.getValue());
byte[] updatedBytes;
if (array.length == 0) {
updatedBytes = TagRecord.builder().tagName(tag).stream(appendValue).build().toBytes();
} else {
TagRecord record = TagRecord.fromBytes(array);
updatedBytes = record.toBuilder().stream(appendValue).build().toBytes();
}
return TableSegmentEntry.versioned(tag.getBytes(StandardCharsets.UTF_8), updatedBytes, entry.getKey().getVersion().getSegmentVersion());
}
Aggregations