RecordStorage

public abstract class RecordStorage<I> extends AbstractStorage<I, M, R> implements StorageWithLifecycleFlags<I, M, R>, BulkStorageOperationsMixin<I, R>

A storage keeping messages with identity.

Parameters

<I>

the type of entity IDs

Inheritors

Constructors

Link copied to clipboard
protected void RecordStorage(Class<? extends Entity<? extends Object, ? extends Object>> entityClass, boolean multitenant)
Creates an instance of RecordStorage.

Functions

Link copied to clipboard
protected final ImmutableList<Column> columnList()
Obtains a list of columns of the managed Entity.
Link copied to clipboard
public Columns columns()
Returns the columns of the managed Entity.
Link copied to clipboard
public abstract boolean delete(I id)
Deletes the record with the passed ID.
Link copied to clipboard
public final ImmutableMap<ColumnName, Column> lifecycleColumns()
Returns a Map of columns corresponded to the lifecycle storage fields of the Entity class managed by this storage.
Link copied to clipboard
public Optional<EntityRecord> read(RecordReadRequest<I> request)
Reads a record which matches the specified request.
public Optional<EntityRecord> read(RecordReadRequest<I> request, FieldMask fieldMask)
Reads a record which matches the specified request and applies a FieldMask to it.
Link copied to clipboard
public Iterator<EntityRecord> readAll(ResponseFormat format)
Reads all active items from the storage and apply FieldMask to each of the results.
public Iterator<EntityRecord> readAll(EntityQuery<I> query)
public Iterator<EntityRecord> readAll(EntityQuery<I> query, ResponseFormat format)
Reads all the records matching the given EntityQuery and applies the given FieldMask to the resulting record states.
Link copied to clipboard
protected abstract Iterator<EntityRecord> readAllRecords(ResponseFormat format)
Obtains an iterator for reading all records.
protected abstract Iterator<EntityRecord> readAllRecords(EntityQuery<I> query, ResponseFormat format)
Obtains an iterator for reading records matching the query, and applying the passed field mask to the results.
Link copied to clipboard
public Optional<LifecycleFlags> readLifecycleFlags(I id)
Reads the lifecycle status for the entity with the passed ID.
Link copied to clipboard
public Iterator<EntityRecord> readMultiple(Iterable<I> ids, FieldMask fieldMask)
Reads multiple active items from the storage and applies FieldMask to the results.
Link copied to clipboard
protected abstract Iterator<EntityRecord> readMultipleRecords(Iterable<I> ids, FieldMask fieldMask)
Obtains an iterator for reading multiple records by IDs, and applying the passed field mask to the results.
Link copied to clipboard
protected abstract Optional<EntityRecord> readRecord(I id)
Reads a record from the storage by the passed ID.
Link copied to clipboard
public void write(Map<I, EntityRecordWithColumns> records)
Writes a bulk of records into the storage.
public void write(I id, EntityRecord record)
Writes a record into the storage.
public void write(I id, EntityRecordWithColumns record)
Writes a record and its columns into the storage.
Link copied to clipboard
public void writeLifecycleFlags(I id, LifecycleFlags flags)
Writes the lifecycle status for the entity with the passed ID.
Link copied to clipboard
protected abstract void writeRecord(I id, EntityRecordWithColumns record)
Writes a record and the associated column values into the storage.
Link copied to clipboard
protected abstract void writeRecords(Map<I, EntityRecordWithColumns> records)
Writes a bulk of records into the storage.

Inherited functions

Link copied to clipboard
protected void checkNotClosed()
protected void checkNotClosed(String message)
Ensures the storage is not closed.
Link copied to clipboard
public void close()
Closes the storage.
public abstract void close()
Link copied to clipboard
public abstract Iterator<I> index()
Returns an iterator over identifiers of records in the storage.
Link copied to clipboard
public boolean isClosed()
Tests whether the storage is closed.
Link copied to clipboard
public boolean isMultitenant()
Verifies whether the storage is multitenant.
Link copied to clipboard
public boolean isOpen()
Tests whether the storage is open.