public interface FeatureStore
extends java.io.Closeable
Delete and upsert requests are versioned-- if the version number in the request is less than the currently stored version of the object, the request should be ignored.
These semantics support the primary use case for the store, which synchronizes a collection of objects based on update messages that may be received out-of-order.
Modifier and Type | Method and Description |
---|---|
<T extends VersionedData> |
all(VersionedDataKind<T> kind)
Returns a
Map of all associated objects of a given kind. |
<T extends VersionedData> |
delete(VersionedDataKind<T> kind,
java.lang.String key,
int version)
Deletes the object associated with the specified key, if it exists and its version
is less than or equal to the specified version.
|
<T extends VersionedData> |
get(VersionedDataKind<T> kind,
java.lang.String key)
Returns the object to which the specified key is mapped, or
null if the key is not associated or the associated object has
been deleted.
|
void |
init(java.util.Map<VersionedDataKind<?>,java.util.Map<java.lang.String,? extends VersionedData>> allData)
Initializes (or re-initializes) the store with the specified set of objects.
|
boolean |
initialized()
Returns true if this store has been initialized.
|
<T extends VersionedData> |
upsert(VersionedDataKind<T> kind,
T item)
Update or insert the object associated with the specified key, if its version
is less than or equal to the version specified in the argument object.
|
<T extends VersionedData> T get(VersionedDataKind<T> kind, java.lang.String key)
T
- class of the object that will be returnedkind
- the kind of object to getkey
- the key whose associated object is to be returned<T extends VersionedData> java.util.Map<java.lang.String,T> all(VersionedDataKind<T> kind)
Map
of all associated objects of a given kind.T
- class of the objects that will be returned in the mapkind
- the kind of objects to getvoid init(java.util.Map<VersionedDataKind<?>,java.util.Map<java.lang.String,? extends VersionedData>> allData)
If possible, the store should update the entire data set atomically. If that is not possible, it should iterate through the outer map and then the inner map in the order provided (the SDK will use a Map subclass that has a defined ordering), storing each item, and then delete any leftover items at the very end.
The store should not attempt to modify any of the Maps, and if it needs to retain the data in memory it should copy the Maps.
allData
- all objects to be stored<T extends VersionedData> void delete(VersionedDataKind<T> kind, java.lang.String key, int version)
T
- class of the object to be deletedkind
- the kind of object to deletekey
- the key of the object to be deletedversion
- the version for the delete operation<T extends VersionedData> void upsert(VersionedDataKind<T> kind, T item)
T
- class of the object to be updatedkind
- the kind of object to updateitem
- the object to update or insertboolean initialized()