Interface PersistentStore
-
- All Superinterfaces:
AutoCloseable
public interface PersistentStore extends AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
PersistentStore.Handle
Represents a handle to the underlying space of key-value pairs.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PersistentStore.Handle
createSpace()
Creates a store space to be used to store key-value pairs.void
dropStoreSpace(PersistentStore.Handle handle)
Drops the store space specified by the supplied handle.Map<okio.ByteString,okio.ByteString>
get(PersistentStore.Handle handle, List<okio.ByteString> keys)
Gets the values associated with the entries specified bykeys
.Optional<okio.ByteString>
get(PersistentStore.Handle handle, okio.ByteString key)
Gets the value associated with the entry specified bykey
.void
put(PersistentStore.Handle handle, Map<okio.ByteString,okio.ByteString> toWrite)
Stores the entry pairs given intoWrite
, overwriting the existing values.void
put(PersistentStore.Handle handle, okio.ByteString key, okio.ByteString value)
Stores thevalue
for the associatedkey
while overwriting the existing value in the specified store space.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
get
Optional<okio.ByteString> get(PersistentStore.Handle handle, @Nonnull okio.ByteString key)
Gets the value associated with the entry specified bykey
.- Parameters:
handle
- of the store space from which we want to retrieve the valuekey
- entry key for which we want to retrieve the value- Returns:
- the
Optional
containing the value or empty if there is no associated value - Throws:
com.palantir.logsafe.exceptions.SafeIllegalArgumentException
- when referencing a non existing store space
-
get
Map<okio.ByteString,okio.ByteString> get(PersistentStore.Handle handle, List<okio.ByteString> keys)
Gets the values associated with the entries specified bykeys
. Keys which are not present in the store will not be included in the returned map.- Parameters:
handle
- of the store spacekeys
- representing keys for which we want to retrieve the values- Returns:
- a map from keys to values
-
put
void put(PersistentStore.Handle handle, @Nonnull okio.ByteString key, @Nonnull okio.ByteString value)
Stores thevalue
for the associatedkey
while overwriting the existing value in the specified store space.- Parameters:
handle
- of the store to which we should store the entrykey
- entry keyvalue
- entry value- Throws:
com.palantir.logsafe.exceptions.SafeIllegalArgumentException
- when referencing a non existing store space
-
put
void put(PersistentStore.Handle handle, Map<okio.ByteString,okio.ByteString> toWrite)
Stores the entry pairs given intoWrite
, overwriting the existing values.- Parameters:
handle
- of the store space to which we should store the entrytoWrite
- entry pairs to write- Throws:
com.palantir.logsafe.exceptions.SafeIllegalArgumentException
- when referencing a non existing store space
-
createSpace
PersistentStore.Handle createSpace()
Creates a store space to be used to store key-value pairs. Each call creates a new store space.- Returns:
- handle to the created store space
-
dropStoreSpace
void dropStoreSpace(PersistentStore.Handle handle)
Drops the store space specified by the supplied handle. Dropping of a store space may fail if there are concurrent calls on the same store space or if the store space has already been dropped.- Parameters:
handle
- of the store space- Throws:
com.palantir.logsafe.exceptions.SafeIllegalArgumentException
- if thehandle
points to a non-existing store space
-
-