public interface IAsynchronousWriteBufferFactory
Modifier and Type | Method and Description |
---|---|
<T extends IKeyArrayIndexProcedure,O,R,A> |
newWriteBuffer(IResultHandler<R,A> resultHandler,
IDuplicateRemover<O> duplicateRemover,
AbstractKeyArrayIndexProcedureConstructor<T> ctor)
Asynchronous write API (streaming writes).
|
<T extends IKeyArrayIndexProcedure,O,R,A> IRunnableBuffer<KVO<O>[]> newWriteBuffer(IResultHandler<R,A> resultHandler, IDuplicateRemover<O> duplicateRemover, AbstractKeyArrayIndexProcedureConstructor<T> ctor)
The returned buffer provides a streaming API which is highly efficient.
The caller writes ordered KVO
[] chunks onto the thread-safe
BlockingBuffer
. Those chunks are dynamically combined and then
split into per-index partition chunks which are written on internally
managed BlockingBuffer
s for each index partition which will be
touched by a write operation. The splits are slices of ordered chunks for
a specific index partition. The BlockingBuffer
uses a merge sort
when it combines ordered chunks so that the combined chunks remain fully
ordered. Once a chunk is ready, it is re-shaped for the CTOR and sent to
the target data service using RMI.
Since this API is asynchronous, you will not have synchronous access to
values returned by asynchronous writes. However, patterns can be created
using KVOC
and KVOLatch
which provide notification when
application defined sets of results have become available. Such patterns
are created by associated the KVOLatch
with the set of results
and using IResultHandler
and the object reference on the
KVOC
to capture the side-effect of the write.
BlockingBuffer.getFuture()
may be used to obtain the
Future
of the consumer. You can use Future.get()
to await
the completion of the consumer, to cancel the consumer, etc. The
Future
will not terminate (other than by error) until the buffer
has been closed
. The Future
evaluates to an IndexAsyncWriteStats
object. Those statistics are
also reported to the ILoadBalancerService
via the
IBigdataFederation
.
Each buffer returned by this method is independent, and writes onto
independent sinks which write through to the index partitions. This is
necessary in order for the caller to retain control over the life cycle
of their write operations. The BlockingBuffer
is thread-safe so
it may be the target for concurrent producers can be can utilized to
create very high throughput designs. While the returned buffers are
independent, the performance counters for all asynchronous write buffers
for a given client and scale-out index are aggregated by a single
ScaleOutIndexCounters
instance.
T
- The generic type of the procedure used to write on the index.O
- The generic type for unserialized value objects.R
- The type of the result from applying the index procedure to a
single Split
of data.A
- The type of the aggregated result.resultHandler
- Used to aggregate results.duplicateRemover
- Used to filter out duplicates in an application specified
manner (optional).ctor
- Used to create instances of the procedure that will execute a
write on an individual index partition (this implies that
insert and remove operations as well as custom index write
operations must use separate buffers).IndexMetadata.getAsynchronousIndexWriteConfiguration()
,
AbstractFederation.getIndexCounters(String)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.