K
- key typepublic interface DatasetWriterReader<K extends java.lang.Comparable<K>> extends DatasetReader<K>
Operations on a dataset fall in to two classes:
add(Comparable, Cell[])
DatasetReader.get(Comparable)
update(Comparable, UpdateOperation)
delete(Comparable)
DatasetReader.records()
datasetWriterReader.records() .filter(predicate) .delete();
Functional types passed to dataset methods can be expressed as either opaque
or transparent types. Lambda expressions and those utilizing user types are
opaque to the dataset. Functions expressed using the
functional DSL
are however
transparent. This means their behavior is well understood, and therefore a
much larger set of optimizations can be applied to the operation concerned.
Modifier and Type | Method and Description |
---|---|
default boolean |
add(K key,
Cell<?>... cells)
Creates a record for the specified key.
|
boolean |
add(K key,
java.lang.Iterable<Cell<?>> cells)
Creates a record for the specified key.
|
default AsyncDatasetWriterReader<K> |
async()
Returns an asynchronous version of this writer-reader using the
ForkJoinPool.commonPool() as an executor. |
AsyncDatasetWriterReader<K> |
async(java.util.concurrent.Executor executor)
Returns an asynchronous version of this writer-reader.
|
boolean |
delete(K key)
Deletes a record for the specified key.
|
ReadWriteRecordAccessor<K> |
on(K key)
Returns a ReadWriteRecordAccessor which can be used to for fine-control of
read and write operations on the record held against the specified key.
|
MutableRecordStream<K> |
records()
Returns a
Stream of the records in this dataset. |
boolean |
update(K key,
UpdateOperation<? super K> transform)
Updates a record for the specified key using the specified UpdateOperation.
|
deregisterChangeListener, get, getKeyType, registerChangeListener
default boolean add(K key, Cell<?>... cells)
key
- key for the recordcells
- cells which form the recordboolean add(K key, java.lang.Iterable<Cell<?>> cells)
key
- key for the recordcells
- a non-null
Iterable
supplying the cells which form the recordjava.lang.NullPointerException
- if cells
is null
boolean update(K key, UpdateOperation<? super K> transform)
key
- key of the record to mutatetransform
- the mutating transformation to apply to the recordboolean delete(K key)
key
- key of the record to removeReadWriteRecordAccessor<K> on(K key)
on
in interface DatasetReader<K extends java.lang.Comparable<K>>
key
- key for the recordMutableRecordStream<K> records()
Stream
of the records in this dataset.records
in interface DatasetReader<K extends java.lang.Comparable<K>>
default AsyncDatasetWriterReader<K> async()
ForkJoinPool.commonPool()
as an executor.async
in interface DatasetReader<K extends java.lang.Comparable<K>>
AsyncDatasetWriterReader<K> async(java.util.concurrent.Executor executor)
Any asynchronous tasks associated with operations run through the returned writer-reader will be submitted to the given executor.
async
in interface DatasetReader<K extends java.lang.Comparable<K>>
executor
- executor for asynchronous tasks