I
- the type of identifiersM
- the type of recordsR
- the type of read requests@SPI
public interface Storage<I,M extends com.google.protobuf.Message,R extends ReadRequest<I>>
extends java.lang.AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the storage.
|
java.util.Iterator<I> |
index()
Returns an iterator over identifiers of records in the storage.
|
boolean |
isMultitenant()
Verifies whether the storage is multitenant.
|
boolean |
isOpen()
Verifies whether the storage is open.
|
java.util.Optional<M> |
read(R request)
Reads a record from the storage by the specified request.
|
void |
write(I id,
M record)
Writes a record into the storage.
|
boolean isMultitenant()
true
if the storage was created with multitenancy support,
false
otherwisejava.util.Iterator<I> index()
java.util.Optional<M> read(R request)
request
- the request to read the recordOptional.empty()
if there is no record matching this requestjava.lang.IllegalStateException
- if the storage was closed beforevoid write(I id, M record)
Rewrites it if a record with this ID already exists in the storage.
id
- the ID for the recordrecord
- the record to storejava.lang.IllegalStateException
- if the storage is closedvoid close()
Implementations may throw specific exceptions.
close
in interface java.lang.AutoCloseable
boolean isOpen()
true
if the storage is open, false
otherwise