I
- the type of entity IDspublic final class InMemoryRecordStorage<I> extends RecordStorage<I>
RecordStorage
.Modifier and Type | Method and Description |
---|---|
boolean |
delete(I id)
Deletes the record with the passed ID.
|
java.util.Iterator<I> |
index()
Returns an iterator over identifiers of records in the storage.
|
protected java.util.Iterator<io.spine.server.entity.EntityRecord> |
readAllRecords(EntityQuery<I> query,
io.spine.client.ResponseFormat format)
Obtains an iterator for reading records matching the query,
and applying the passed field mask to the results.
|
protected java.util.Iterator<io.spine.server.entity.EntityRecord> |
readAllRecords(io.spine.client.ResponseFormat format)
Obtains an iterator for reading all records.
|
protected java.util.Iterator<io.spine.server.entity.EntityRecord> |
readMultipleRecords(java.lang.Iterable<I> givenIds,
com.google.protobuf.FieldMask fieldMask)
Obtains an iterator for reading multiple records by IDs, and
applying the passed field mask to the results.
|
protected java.util.Optional<io.spine.server.entity.EntityRecord> |
readRecord(I id)
Reads a record from the storage by the passed ID.
|
protected void |
writeRecord(I id,
EntityRecordWithColumns record)
Writes a record and the associated column
values into the storage.
|
protected void |
writeRecords(java.util.Map<I,EntityRecordWithColumns> records)
Writes a bulk of records into the storage.
|
columnList, read, read, readAll, readAll, readAll, readLifecycleFlags, readMultiple, write, write, write, writeLifecycleFlags
checkNotClosed, checkNotClosed, close, isClosed, isMultitenant, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isMultitenant, isOpen
public java.util.Iterator<I> index()
Storage
public boolean delete(I id)
RecordStorage
delete
in class RecordStorage<I>
id
- the record to deletetrue
if the operation succeeded, false
otherwiseprotected java.util.Iterator<io.spine.server.entity.EntityRecord> readMultipleRecords(java.lang.Iterable<I> givenIds, com.google.protobuf.FieldMask fieldMask)
RecordStorage
The size of the returned Iterator
matches the size of the given ids
,
with nulls in place of missing or inactive entities.
readMultipleRecords
in class RecordStorage<I>
BulkStorageOperationsMixin.readMultiple(java.lang.Iterable<I>, com.google.protobuf.FieldMask)
protected java.util.Iterator<io.spine.server.entity.EntityRecord> readAllRecords(io.spine.client.ResponseFormat format)
RecordStorage
Only active entities are returned.
readAllRecords
in class RecordStorage<I>
format
- the expected format of the query responseBulkStorageOperationsMixin.readAll(io.spine.client.ResponseFormat)
protected java.util.Iterator<io.spine.server.entity.EntityRecord> readAllRecords(EntityQuery<I> query, io.spine.client.ResponseFormat format)
RecordStorage
Returns only active entities if the query does not specify the lifecycle flags. In order to read inactive entities, the corresponding filters must be set
to the provided query
.
readAllRecords
in class RecordStorage<I>
RecordStorage.readAll(EntityQuery, ResponseFormat)
protected java.util.Optional<io.spine.server.entity.EntityRecord> readRecord(I id)
RecordStorage
readRecord
in class RecordStorage<I>
id
- the ID of the record to loadnull
if there is no record with this IDprotected void writeRecord(I id, EntityRecordWithColumns record)
RecordStorage
Rewrites it if a record with this ID already exists in the storage.
writeRecord
in class RecordStorage<I>
id
- an ID of the recordrecord
- a record to storeprotected void writeRecords(java.util.Map<I,EntityRecordWithColumns> records)
RecordStorage
Rewrites it if a record with this ID already exists in the storage.
writeRecords
in class RecordStorage<I>
records
- an ID to record map with the entries to store