Packages

trait KVStore extends Closeable

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.

Linear Supertypes
Closeable, AutoCloseable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. KVStore
  2. Closeable
  3. AutoCloseable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def close(): Unit
    Definition Classes
    Closeable → AutoCloseable
    Annotations
    @throws( classOf[java.io.IOException] )
  2. abstract def count(type: Class[_], index: String, indexedValue: Any): Long

    Returns the number of items of the given type which match the given indexed value.

  3. abstract def count(type: Class[_]): Long

    Returns the number of items of the given type currently in the store.

  4. abstract def delete(type: Class[_], naturalKey: Any): Unit

    Removes an object and all data related to it, like index entries, from the store.

    Removes an object and all data related to it, like index entries, from the store.

    type

    The object's type.

    naturalKey

    The object's "natural key", which uniquely identifies it. Null keys are not allowed.

    Exceptions thrown

    java.util.NoSuchElementException If an element with the given key does not exist.

  5. abstract def getMetadata[T](klass: Class[T]): T

    Returns app-specific metadata from the store, or null if it's not currently set.

    Returns app-specific metadata from the store, or null if it's not currently set.

    The metadata type is application-specific. This is a convenience method so that applications don't need to define their own keys for this information.

  6. abstract def read[T](klass: Class[T], naturalKey: Any): T

    Read a specific instance of an object.

    Read a specific instance of an object.

    naturalKey

    The object's "natural key", which uniquely identifies it. Null keys are not allowed.

    Exceptions thrown

    java.util.NoSuchElementException If an element with the given key does not exist.

  7. abstract def removeAllByIndexValues[T](klass: Class[T], index: String, indexValues: Collection[_]): Boolean

    A cheaper way to remove multiple items from the KVStore

  8. abstract def setMetadata(value: Any): Unit

    Writes the given value in the store metadata key.

  9. abstract def view[T](type: Class[T]): KVStoreView[T]

    Returns a configurable view for iterating over entities of the given type.

  10. abstract def write(value: Any): Unit

    Writes the given object to the store, including indexed fields.

    Writes the given object to the store, including indexed fields. Indices are updated based on the annotated fields of the object's class.

    Writes may be slower when the object already exists in the store, since it will involve updating existing indices.

    value

    The object to write.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from Closeable

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped