use of org.apache.bookkeeper.stream.protocol.RangeId in project bookkeeper by apache.
the class StorageContainerImpl method delete.
@Override
public CompletableFuture<StorageContainerResponse> delete(StorageContainerRequest request) {
checkArgument(KV_DELETE_REQ == request.getRequestCase());
long scId = request.getScId();
DeleteRangeRequest rr = request.getKvDeleteReq();
RoutingHeader header = rr.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.delete(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.delete(request));
}
}
use of org.apache.bookkeeper.stream.protocol.RangeId in project bookkeeper by apache.
the class MVCCStoreFactoryImpl method addStore.
private synchronized void addStore(long scId, long streamId, long rangeId, MVCCAsyncStore<byte[], byte[]> store) {
Map<RangeId, MVCCAsyncStore<byte[], byte[]>> scStores = stores.get(scId);
if (null == scStores) {
scStores = Maps.newHashMap();
}
RangeId rid = RangeId.of(streamId, rangeId);
MVCCAsyncStore<byte[], byte[]> oldStore = scStores.get(rid);
if (null != oldStore) {
store.closeAsync();
} else {
log.info("Add store (scId = {}, streamId = {}, rangeId = {})", scId, streamId, rangeId);
scStores.put(rid, store);
}
}
use of org.apache.bookkeeper.stream.protocol.RangeId in project bookkeeper by apache.
the class StorageContainerImpl method range.
//
// Table API
//
@Override
public CompletableFuture<StorageContainerResponse> range(StorageContainerRequest request) {
checkArgument(KV_RANGE_REQ == request.getRequestCase());
long scId = request.getScId();
RangeRequest rr = request.getKvRangeReq();
RoutingHeader header = rr.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.range(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.range(request));
}
}
use of org.apache.bookkeeper.stream.protocol.RangeId in project bookkeeper by apache.
the class StorageContainerImpl method incr.
@Override
public CompletableFuture<StorageContainerResponse> incr(StorageContainerRequest request) {
checkArgument(KV_INCR_REQ == request.getRequestCase());
long scId = request.getScId();
IncrementRequest ir = request.getKvIncrReq();
RoutingHeader header = ir.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.incr(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.incr(request));
}
}
use of org.apache.bookkeeper.stream.protocol.RangeId in project bookkeeper by apache.
the class StorageContainerImpl method put.
@Override
public CompletableFuture<StorageContainerResponse> put(StorageContainerRequest request) {
checkArgument(KV_PUT_REQ == request.getRequestCase());
long scId = request.getScId();
PutRequest rr = request.getKvPutReq();
RoutingHeader header = rr.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.put(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.put(request));
}
}
Aggregations