Search in sources :

Example 1 with TxnRequest

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

the class StorageContainerImpl method txn.

@Override
public CompletableFuture<StorageContainerResponse> txn(StorageContainerRequest request) {
    checkArgument(KV_TXN_REQ == request.getRequestCase());
    long scId = request.getScId();
    TxnRequest rr = request.getKvTxnReq();
    RoutingHeader header = rr.getHeader();
    RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
    TableStore store = tableStoreCache.getTableStore(rid);
    if (null != store) {
        return store.txn(request);
    } else {
        return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.txn(request));
    }
}
Also used : TxnRequest(org.apache.bookkeeper.stream.proto.kv.rpc.TxnRequest) RoutingHeader(org.apache.bookkeeper.stream.proto.kv.rpc.RoutingHeader) RangeId(org.apache.bookkeeper.stream.protocol.RangeId) TableStore(org.apache.bookkeeper.stream.storage.api.kv.TableStore)

Aggregations

RoutingHeader (org.apache.bookkeeper.stream.proto.kv.rpc.RoutingHeader)1 TxnRequest (org.apache.bookkeeper.stream.proto.kv.rpc.TxnRequest)1 RangeId (org.apache.bookkeeper.stream.protocol.RangeId)1 TableStore (org.apache.bookkeeper.stream.storage.api.kv.TableStore)1