Search in sources :

Example 1 with Compare

use of org.apache.bookkeeper.stream.proto.kv.rpc.Compare in project bookkeeper by apache.

the class TableStoreImpl method buildTxnOp.

private TxnOp<byte[], byte[]> buildTxnOp(TxnRequest request) {
    RoutingHeader header = request.getHeader();
    TxnOpBuilder<byte[], byte[]> txnBuilder = store.getOpFactory().newTxn();
    for (RequestOp requestOp : request.getSuccessList()) {
        txnBuilder.Then(buildTxnOp(header, requestOp));
    }
    for (RequestOp requestOp : request.getFailureList()) {
        txnBuilder.Else(buildTxnOp(header, requestOp));
    }
    for (Compare compare : request.getCompareList()) {
        txnBuilder.If(fromProtoCompare(store.getOpFactory(), header, compare));
    }
    return txnBuilder.build();
}
Also used : RoutingHeader(org.apache.bookkeeper.stream.proto.kv.rpc.RoutingHeader) Compare(org.apache.bookkeeper.stream.proto.kv.rpc.Compare) TableStoreUtils.fromProtoCompare(org.apache.bookkeeper.stream.storage.impl.kv.TableStoreUtils.fromProtoCompare) RequestOp(org.apache.bookkeeper.stream.proto.kv.rpc.RequestOp)

Aggregations

Compare (org.apache.bookkeeper.stream.proto.kv.rpc.Compare)1 RequestOp (org.apache.bookkeeper.stream.proto.kv.rpc.RequestOp)1 RoutingHeader (org.apache.bookkeeper.stream.proto.kv.rpc.RoutingHeader)1 TableStoreUtils.fromProtoCompare (org.apache.bookkeeper.stream.storage.impl.kv.TableStoreUtils.fromProtoCompare)1