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.Optional<com.google.protobuf.ByteString>
get(PersistentStore.Handle handle, com.google.protobuf.ByteString key)
Gets the value associated with the entry specified bykey
.Map<com.google.protobuf.ByteString,com.google.protobuf.ByteString>
get(PersistentStore.Handle handle, List<com.google.protobuf.ByteString> keys)
Gets the values associated with the entries specified bykeys
.void
put(PersistentStore.Handle handle, com.google.protobuf.ByteString key, com.google.protobuf.ByteString value)
Stores thevalue
for the associatedkey
while overwriting the existing value in the specified store space.void
put(PersistentStore.Handle handle, Map<com.google.protobuf.ByteString,com.google.protobuf.ByteString> toWrite)
Stores the entry pairs given intoWrite
, overwriting the existing values.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
get
Optional<com.google.protobuf.ByteString> get(PersistentStore.Handle handle, @Nonnull com.google.protobuf.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<com.google.protobuf.ByteString,com.google.protobuf.ByteString> get(PersistentStore.Handle handle, List<com.google.protobuf.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 com.google.protobuf.ByteString key, @Nonnull com.google.protobuf.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<com.google.protobuf.ByteString,com.google.protobuf.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
-
-