Search in sources :

Example 1 with Persistable

use of com.palantir.common.persist.Persistable in project atlasdb by palantir.

the class StreamingTable method storeStreamForRow.

private Long storeStreamForRow(byte[] data, String rowName) {
    StreamTestTableFactory tableFactory = StreamTestTableFactory.of();
    ValueStreamStore streamTestStreamStore = ValueStreamStore.of(getTransactionManager(), tableFactory);
    final Long streamId = streamTestStreamStore.storeStream(new ByteArrayInputStream(data)).getLhSide();
    getTransactionManager().runTaskThrowOnConflict(txn -> {
        KeyValueTable table = tableFactory.getKeyValueTable(txn);
        KeyValueTable.KeyValueRow row = KeyValueTable.KeyValueRow.of(rowName);
        KeyValueTable.StreamId id = KeyValueTable.StreamId.of(streamId);
        Multimap<Persistable, ColumnValue<?>> rows = ImmutableMultimap.of(row, id);
        txn.put(table.getTableRef(), ColumnValues.toCellValues(rows));
        return null;
    });
    return streamId;
}
Also used : Persistable(com.palantir.common.persist.Persistable) ByteArrayInputStream(java.io.ByteArrayInputStream) KeyValueTable(com.palantir.atlasdb.performance.schema.generated.KeyValueTable) ColumnValue(com.palantir.atlasdb.table.api.ColumnValue) StreamTestTableFactory(com.palantir.atlasdb.performance.schema.generated.StreamTestTableFactory) ValueStreamStore(com.palantir.atlasdb.performance.schema.generated.ValueStreamStore)

Aggregations

KeyValueTable (com.palantir.atlasdb.performance.schema.generated.KeyValueTable)1 StreamTestTableFactory (com.palantir.atlasdb.performance.schema.generated.StreamTestTableFactory)1 ValueStreamStore (com.palantir.atlasdb.performance.schema.generated.ValueStreamStore)1 ColumnValue (com.palantir.atlasdb.table.api.ColumnValue)1 Persistable (com.palantir.common.persist.Persistable)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1