package kvstore
Type Members
-
class
InMemoryStore extends KVStore
Implementation of KVStore that keeps data deserialized in memory.
Implementation of KVStore that keeps data deserialized in memory. This store does not index data; instead, whenever iterating over an indexed field, the stored data is copied and sorted according to the index. This saves memory but makes iteration more expensive.
- class KVIndex extends Annotation with Annotation with ClassfileAnnotation
-
trait
KVStore extends Closeable
Abstraction for a local key/value store for storing app data.
Abstraction for a local key/value store for storing app data.
There are two main features provided by the implementations of this interface:
Serialization
If the underlying data store requires serialization, data will be serialized to and deserialized using a
KVStoreSerializer, which can be customized by the application. The serializer is based on Jackson, so it supports all the Jackson annotations for controlling the serialization of app-defined types.Data is also automatically compressed to save disk space.
Automatic Key Management
When using the built-in key management, the implementation will automatically create unique keys for each type written to the store. Keys are based on the type name, and always start with the "+" prefix character (so that it's easy to use both manual and automatic key management APIs without conflicts).
Another feature of automatic key management is indexing; by annotating fields or methods of objects written to the store with
KVIndex, indices are created to sort the data by the values of those properties. This makes it possible to provide sorting without having to load all instances of those types from the store.KVStore instances are thread-safe for both reads and writes.
-
trait
KVStoreIterator[T] extends Iterator[T] with Closeable
An iterator for KVStore.
An iterator for KVStore.
Iterators may keep references to resources that need to be closed. It's recommended that users explicitly close iterators after they're used.
-
class
KVStoreSerializer extends AnyRef
Serializer used to translate between app-defined types and the LevelDB store.
Serializer used to translate between app-defined types and the LevelDB store.
The serializer is based on Jackson, so values are written as JSON. It also allows "naked strings" and integers to be written as values directly, which will be written as UTF-8 strings.
-
abstract
class
KVStoreView[T] extends Iterable[T]
A configurable view that allows iterating over values in a
KVStore.A configurable view that allows iterating over values in a
KVStore.The different methods can be used to configure the behavior of the iterator. Calling the same method multiple times is allowed; the most recent value will be used.
The iterators returned by this view are of type
KVStoreIterator; they auto-close when used in a for loop that exhausts their contents, but when used manually, they need to be closed explicitly unless all elements are read. -
class
KVTypeInfo extends AnyRef
Wrapper around types managed in a KVStore, providing easy access to their indexed fields.
-
class
LevelDB extends KVStore
Implementation of KVStore that uses LevelDB as the underlying data store.
-
class
UnsupportedStoreVersionException extends IOException
Exception thrown when the store implementation is not compatible with the underlying data.