com.thinkaurelius.titan.diskstorage.keycolumnvalue

## Interface KeyColumnValueStore

- All Known Implementing Classes:
    BaseKeyColumnValueAdapter, ExpectedValueCheckingStore, ExpirationKCVSCache, InMemoryKeyColumnValueStore, KCVSCache, KCVSProxy, MetricInstrumentedStore, NoKCVSCache, OrderedKeyValueStoreAdapter, ReadOnlyKeyColumnValueStore, TTLKCVS

      public interface KeyColumnValueStore

  Interface to a data store that has a BigTable like representation of its data. In other words, the data store is comprised of a set of rows each of which is uniquely identified by a key. Each row is composed of a column-value pairs. For a given key, a subset of the column-value pairs that fall within a column interval can be quickly retrieved.

  This interface provides methods for retrieving and mutating the data.

  In this generic representation keys, columns and values are represented as ByteBuffers.

  See
  Author:
    Matthias Bröcheler (me@matthiasb.com);

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static List<Entry>` | `NO_ADDITIONS`
    `static List<StaticBuffer>` | `NO_DELETIONS`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `acquireLock(StaticBuffer key, StaticBuffer column, StaticBuffer expectedValue, StoreTransaction txh)` Attempts to claim a lock on the value at the specified `key` and `column` pair.
    `void` | `close()` Closes this store
    `KeyIterator` | `getKeys(KeyRangeQuery query, StoreTransaction txh)` Returns a `KeyIterator` over all keys that fall within the key-range specified by the given query and have one or more columns matching the column-range.
    `KeyIterator` | `getKeys(SliceQuery query, StoreTransaction txh)` Returns a `KeyIterator` over all keys in the store that have one or more columns matching the column-range.
    `String` | `getName()` Returns the name of this store.
    `EntryList` | `getSlice(KeySliceQuery query, StoreTransaction txh)` Retrieves the list of entries (i.e.
    `Map<StaticBuffer,EntryList>` | `getSlice(List<StaticBuffer> keys, SliceQuery query, StoreTransaction txh)` Retrieves the list of entries (i.e.
    `void` | `mutate(StaticBuffer key, List<Entry> additions, List<StaticBuffer> deletions, StoreTransaction txh)` Verifies acquisition of locks `txh` from previous calls to `acquireLock(StaticBuffer, StaticBuffer, StaticBuffer, StoreTransaction)` , then writes supplied `additions` and/or `deletions` to `key` in the underlying data store.

- - ### Field Detail

    - #### NO_ADDITIONS

          static final List<Entry> NO_ADDITIONS

    - #### NO_DELETIONS

          static final List<StaticBuffer> NO_DELETIONS

  - ### Method Detail

    - #### getSlice

          EntryList getSlice(KeySliceQuery query,
                           StoreTransaction txh)
                             throws BackendException

      Retrieves the list of entries (i.e. column-value pairs) for a specified query.
      Parameters:
        `query` - Query to get results for
        `txh` - Transaction
      Returns:
        List of entries up to a maximum of "limit" entries
      Throws:
        `BackendException` - when columnEnd < columnStart
      See Also:
        `KeySliceQuery`

    - #### getSlice

          Map<StaticBuffer,EntryList> getSlice(List<StaticBuffer> keys,
                                             SliceQuery query,
                                             StoreTransaction txh)
                                               throws BackendException

      Retrieves the list of entries (i.e. column-value pairs) as specified by the given `SliceQuery` for all of the given keys together.
      Parameters:
        `keys` - List of keys
        `query` - Slicequery specifying matching entries
        `txh` - Transaction
      Returns:
        The result of the query for each of the given keys as a map from the key to the list of result entries.
      Throws:
        `BackendException`

    - #### mutate

          void mutate(StaticBuffer key,
                    List<Entry> additions,
                    List<StaticBuffer> deletions,
                    StoreTransaction txh)
                      throws BackendException

      Verifies acquisition of locks `txh` from previous calls to `acquireLock(StaticBuffer, StaticBuffer, StaticBuffer, StoreTransaction)` , then writes supplied `additions` and/or `deletions` to `key` in the underlying data store. Deletions are applied strictly before additions. In other words, if both an addition and deletion are supplied for the same column, then the column will first be deleted and then the supplied Entry for the column will be added.

      Implementations which don't support locking should skip the initial lock verification step but otherwise behave as described above.
      Parameters:
        `key` - the key under which the columns in `additions` and `deletions` will be written
        `additions` - the list of Entry instances representing column-value pairs to create under `key`, or null to add no column-value pairs
        `deletions` - the list of columns to delete from `key`, or null to delete no columns
        `txh` - the transaction to use
      Throws:
        `PermanentLockingException` - if locking is supported by the implementation and at least one lock acquisition attempted by `acquireLock(StaticBuffer, StaticBuffer, StaticBuffer, StoreTransaction)` has failed
        `BackendException`

    - #### acquireLock

          void acquireLock(StaticBuffer key,
                         StaticBuffer column,
                         StaticBuffer expectedValue,
                         StoreTransaction txh)
                           throws BackendException

      Attempts to claim a lock on the value at the specified `key` and `column` pair. These locks are discretionary.

      If locking fails, implementations of this method may, but are not required to, throw `PermanentLockingException`. This method is not required to determine whether locking actually succeeded and may return without throwing an exception even when the lock can't be acquired. Lock acquisition is only only guaranteed to be verified by the first call to `mutate(StaticBuffer, List, List, StoreTransaction)` on any given `txh`.

      The `expectedValue` must match the actual value present at the `key` and `column` pair. If the true value does not match the `expectedValue`, the lock attempt fails and `LockingException` is thrown. This method may check `expectedValue`. The `mutate()` mutate is required to check it.

      When this method is called multiple times on the same `key`, `column`, and `txh`, calls after the first have no effect.

      Locks acquired by this method must be automatically released on transaction `commit()` or `rollback()`.

      Implementations which don't support locking should throw `UnsupportedOperationException`.
      Parameters:
        `key` - the key on which to lock
        `column` - the column on which to lock
        `expectedValue` - the expected value for the specified key-column pair on which to lock (null means the pair must have no value)
        `txh` - the transaction to use
      Throws:
        `PermanentLockingException` - the lock could not be acquired due to contention with other transactions or a locking-specific storage problem
        `BackendException`

    - #### getKeys

          KeyIterator getKeys(KeyRangeQuery query,
                            StoreTransaction txh)
                              throws BackendException

      Returns a `KeyIterator` over all keys that fall within the key-range specified by the given query and have one or more columns matching the column-range. Calling `KeyIterator.getEntries()` returns the list of all entries that match the column-range specified by the given query.

      This method is only supported by stores which keep keys in byte-order.
      Parameters:
        `query` -
        `txh` -
      Returns:
      Throws:
        `BackendException`

    - #### getKeys

          KeyIterator getKeys(SliceQuery query,
                            StoreTransaction txh)
                              throws BackendException

      Returns a `KeyIterator` over all keys in the store that have one or more columns matching the column-range. Calling `KeyIterator.getEntries()` returns the list of all entries that match the column-range specified by the given query.

      This method is only supported by stores which do not keep keys in byte-order.
      Parameters:
        `query` -
        `txh` -
      Returns:
      Throws:
        `BackendException`

    - #### getName

          String getName()

      Returns the name of this store. Each store has a unique name which is used to open it.
      Returns:
        store name
      See Also:
        `KeyColumnValueStoreManager.openDatabase(String)`

    - #### close

          void close()
                     throws BackendException

      Closes this store
      Throws:
        `BackendException`

Copyright © 2012–2014. All rights reserved.