@InterfaceAudience.Public public interface RawAsyncTable extends AsyncTableBase
The implementation is required to be thread safe.
The returned CompletableFuture
will be finished directly in the rpc framework's callback
thread, so typically you should not do any time consuming work inside these methods, otherwise
you will be likely to block at least one connection to RS(even more if the rpc framework uses
NIO).
So, only experts that want to build high performance service should use this interface directly,
especially for the scan(Scan, RawScanResultConsumer)
below.
TODO: For now the only difference between this interface and AsyncTable
is the scan
method. The RawScanResultConsumer
exposes the implementation details of a scan(heartbeat)
so it is not suitable for a normal user. If it is still the only difference after we implement
most features of AsyncTable, we can think about merge these two interfaces.
Modifier and Type | Interface and Description |
---|---|
static interface |
RawAsyncTable.CoprocessorCallable<S,R>
Delegate to a protobuf rpc call.
|
static interface |
RawAsyncTable.CoprocessorCallback<R>
The callback when we want to execute a coprocessor call on a range of regions.
|
Modifier and Type | Method and Description |
---|---|
<S,R> CompletableFuture<R> |
coprocessorService(Function<com.google.protobuf.RpcChannel,S> stubMaker,
RawAsyncTable.CoprocessorCallable<S,R> callable,
byte[] row)
Execute the given coprocessor call on the region which contains the given
row . |
<S,R> void |
coprocessorService(Function<com.google.protobuf.RpcChannel,S> stubMaker,
RawAsyncTable.CoprocessorCallable<S,R> callable,
byte[] startKey,
boolean startKeyInclusive,
byte[] endKey,
boolean endKeyInclusive,
RawAsyncTable.CoprocessorCallback<R> callback)
Execute the given coprocessor call on the regions which are covered by the range from
startKey and endKey . |
default <S,R> void |
coprocessorService(Function<com.google.protobuf.RpcChannel,S> stubMaker,
RawAsyncTable.CoprocessorCallable<S,R> callable,
byte[] startKey,
byte[] endKey,
RawAsyncTable.CoprocessorCallback<R> callback)
Execute the given coprocessor call on the regions which are covered by the range from
startKey inclusive and endKey exclusive. |
void |
scan(Scan scan,
RawScanResultConsumer consumer)
The basic scan API uses the observer pattern.
|
append, batch, batchAll, checkAndDelete, checkAndDelete, checkAndMutate, checkAndMutate, checkAndPut, checkAndPut, delete, delete, deleteAll, exists, exists, existsAll, get, get, getAll, getConfiguration, getName, getOperationTimeout, getReadRpcTimeout, getRpcTimeout, getScanTimeout, getWriteRpcTimeout, increment, incrementColumnValue, incrementColumnValue, mutateRow, put, put, putAll, scanAll
void scan(Scan scan, RawScanResultConsumer consumer)
consumer
by calling RawScanResultConsumer.onNext
.
RawScanResultConsumer.onComplete
means the scan is finished, and
RawScanResultConsumer.onError
means we hit an unrecoverable error and the scan is
terminated. RawScanResultConsumer.onHeartbeat
means the RS is still working but we can
not get a valid result to call RawScanResultConsumer.onNext
. This is usually because
the matched results are too sparse, for example, a filter which almost filters out everything
is specified.
Notice that, the methods of the given consumer
will be called directly in the rpc
framework's callback thread, so typically you should not do any time consuming work inside
these methods, otherwise you will be likely to block at least one connection to RS(even more if
the rpc framework uses NIO).
scan
- A configured Scan
object.consumer
- the consumer used to receive results.<S,R> CompletableFuture<R> coprocessorService(Function<com.google.protobuf.RpcChannel,S> stubMaker, RawAsyncTable.CoprocessorCallable<S,R> callable, byte[] row)
row
.
The stubMaker
is just a delegation to the newStub
call. Usually it is only a
one line lambda expression, like:
channel -> xxxService.newStub(channel)
S
- the type of the asynchronous stubR
- the type of the return valuestubMaker
- a delegation to the actual newStub
call.callable
- a delegation to the actual protobuf rpc call. See the comment of
RawAsyncTable.CoprocessorCallable
for more details.row
- The row key used to identify the remote region locationCompletableFuture
.RawAsyncTable.CoprocessorCallable
default <S,R> void coprocessorService(Function<com.google.protobuf.RpcChannel,S> stubMaker, RawAsyncTable.CoprocessorCallable<S,R> callable, byte[] startKey, byte[] endKey, RawAsyncTable.CoprocessorCallback<R> callback)
startKey
inclusive and endKey
exclusive. See the comment of
coprocessorService(Function, CoprocessorCallable, byte[], boolean, byte[], boolean, CoprocessorCallback)
for more details.<S,R> void coprocessorService(Function<com.google.protobuf.RpcChannel,S> stubMaker, RawAsyncTable.CoprocessorCallable<S,R> callable, byte[] startKey, boolean startKeyInclusive, byte[] endKey, boolean endKeyInclusive, RawAsyncTable.CoprocessorCallback<R> callback)
startKey
and endKey
. The inclusive of boundaries are specified by
startKeyInclusive
and endKeyInclusive
. The stubMaker
is just a
delegation to the xxxService.newStub
call. Usually it is only a one line lambda
expression, like:
channel -> xxxService.newStub(channel)
S
- the type of the asynchronous stubR
- the type of the return valuestubMaker
- a delegation to the actual newStub
call.callable
- a delegation to the actual protobuf rpc call. See the comment of
RawAsyncTable.CoprocessorCallable
for more details.startKey
- start region selection with region containing this row. If null
, the
selection will start with the first table region.startKeyInclusive
- whether to include the startKeyendKey
- select regions up to and including the region containing this row. If
null
, selection will continue through the last table region.endKeyInclusive
- whether to include the endKeycallback
- callback to get the response. See the comment of RawAsyncTable.CoprocessorCallback
for more details.RawAsyncTable.CoprocessorCallable
,
RawAsyncTable.CoprocessorCallback
Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.