Package org.rostore.client
Class GeneralContainer<K>
java.lang.Object
org.rostore.client.GeneralContainer<K>
- Type Parameters:
K- key type
Represents a simple rostore container.
Create this object by using the RoStoreClient.getGeneralContainer(String)
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGeneralContainer(RoStoreClient roStoreClient, String name, KeySerializer<K> keySerializer) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(org.rostore.entity.media.ContainerMeta containerMeta) Creates a new container<V> VersionedObject<K, V> get(K key, EnumSet<org.rostore.entity.media.RecordOption> options, Function<InputStream, V> deserializer) <V> VersionedObject<K, V> get(K key, Function<InputStream, V> deserializer) getKeyPath(K key) org.rostore.entity.media.ContainerMetagetMeta()Returns the container's metadatagetName()<V> VersionedObject<K, V> getWrapped(K key, EnumSet<org.rostore.entity.media.RecordOption> options, Function<VersionedObject<K, InputStream>, VersionedObject<K, V>> transformation) Lists the keys within the container.post(VersionedObject<K, InputStream> versionedObject) post(VersionedObject<K, InputStream> versionedObject, EnumSet<org.rostore.entity.media.RecordOption> options) <V> VersionedObject<K, V> post(VersionedObject<K, V> versionedObject, EnumSet<org.rostore.entity.media.RecordOption> options, Function<V, InputStream> serializer) <V> VersionedObject<K, V> post(VersionedObject<K, V> versionedObject, Function<V, InputStream> serializer) voidremove()Removes container from rostore<V> VersionedObject<K, V> update(VersionedObject<K, V> original, Function<V, V> updateFunction, Function<V, InputStream> serializer, Function<InputStream, V> deserializer) Updates the given entity<V> VersionedObject<K, V> update(VersionedObject<K, V> original, KeyExpirationUpdateFunction keyExpirationUpdateFunction, Function<V, V> updateFunction, Function<V, InputStream> serializer, Function<InputStream, V> deserializer) Updates the given entity
-
Constructor Details
-
GeneralContainer
protected GeneralContainer(RoStoreClient roStoreClient, String name, KeySerializer<K> keySerializer)
-
-
Method Details
-
remove
public void remove()Removes container from rostore -
create
public void create(org.rostore.entity.media.ContainerMeta containerMeta) Creates a new container- Parameters:
containerMeta- container meta data
-
getMeta
public org.rostore.entity.media.ContainerMeta getMeta()Returns the container's metadata- Returns:
- metadata
-
listKeys
Lists the keys within the container.The list of keys can be incomplete. Check
StringKeyList.isMore(), it is set totrueif more entries are available. in the consequent call should be the last key from the previous call.Keys can come unsorted.
- Parameters:
startWithKey- defines the prefix for the keyscontinuationKey- provides the key from the previous call- Returns:
- the partial list of the keys
-
update
public <V> VersionedObject<K,V> update(VersionedObject<K, V> original, KeyExpirationUpdateFunction keyExpirationUpdateFunction, Function<V, V> updateFunction, Function<V, InputStream> serializer, Function<InputStream, V> deserializer) Updates the given entity- Type Parameters:
V-- Parameters:
original- the original entitykeyExpirationUpdateFunction- function that defines the expiration of the key or null, if the update should use the expiration used in the original orbjectupdateFunction- function that updates the value's objectserializer- transforms the value's object to the input streamdeserializer- transforms input stream to the value object- Returns:
- an updated object
-
update
public <V> VersionedObject<K,V> update(VersionedObject<K, V> original, Function<V, V> updateFunction, Function<V, InputStream> serializer, Function<InputStream, V> deserializer) Updates the given entity- Type Parameters:
V-- Parameters:
original- the original entityupdateFunction- function that updates the value's objectserializer- transforms the value's object to the input streamdeserializer- transforms input stream to the object- Returns:
- an updated object
- See Also:
-
getKeyPath
-
removeKey
-
post
public VersionedObject<K,InputStream> post(VersionedObject<K, InputStream> versionedObject, EnumSet<org.rostore.entity.media.RecordOption> options) -
post
-
post
public <V> VersionedObject<K,V> post(VersionedObject<K, V> versionedObject, Function<V, InputStream> serializer) -
post
public <V> VersionedObject<K,V> post(VersionedObject<K, V> versionedObject, EnumSet<org.rostore.entity.media.RecordOption> options, Function<V, InputStream> serializer) -
get
-
get
public <V> VersionedObject<K,V> get(K key, EnumSet<org.rostore.entity.media.RecordOption> options, Function<InputStream, V> deserializer) -
getWrapped
public <V> VersionedObject<K,V> getWrapped(K key, EnumSet<org.rostore.entity.media.RecordOption> options, Function<VersionedObject<K, InputStream>, VersionedObject<K, V>> transformation) -
getName
-