com.h3c.dist.keystore

## Interface KeyStore

- All Known Subinterfaces:
    HAService

      public interface KeyStore

  `KeyStore` allows users to store data as a pair in distributed data store. A pair is represented by a `KeyValueNode`. Information stored in `KeyStore` is distributed across the controller cluster instances. Application name separates the key spaces and hence different applications can use same key names in the `KeyStore`. A user knowing the application name and key can access the `KeyValueNode` from any instance of the controller cluster. `KeyStore` also provides query mechanism to get keys that belong to an application.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `maxKeyValueSize`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `KeyValueNode` | `createNode(String appName, String key, byte[] value)` Create a pair in distributed KeyStore.
    `List<String>` | `getKeys(String appName)` Query for list of key strings for a application name stored in the distributed KeyStore.
    `KeyValueNode` | `getNode(String appName, String key)` Get a KeyValueNode identified by the application name and the key.

- - ### Field Detail

    - #### maxKeyValueSize

          static final int maxKeyValueSize

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getNode

          KeyValueNode getNode(String appName,
                             String key)
                               throws KeyStoreException.KeyNotFoundException,
                                      ServiceNotAvailableException,
                                      InterruptedException

      Get a KeyValueNode identified by the application name and the key. Data associated with the node can be set, altered, queried, deleted through the routines exposed by KeyValueNode.
      Parameters:
        `appName` - application name
        `key` - key for the stored data
      Returns:
        requested KeyValueNode
      Throws:
        `KeyStoreException.KeyNotFoundException` - Key not found
        `InterruptedException` - Operation interrupted exception
        `ServiceNotAvailableException` - Service is not Up

    - #### createNode

          KeyValueNode createNode(String appName,
                                String key,
                                byte[] value)
                                  throws KeyStoreException.KeyExistsException,
                                         ServiceNotAvailableException,
                                         InterruptedException

      Create a pair in distributed KeyStore. As key space is unique per application, if a node with the same key exists for the application, KeyExistsException is thrown. If value
      Parameters:
        `appName` - application name
        `key` - key for stored data
        `value` - data for the node to be created. "null" is valid data
      Returns:
        newly created KeyValueNode in store
      Throws:
        `KeyStoreException.KeyExistsException` - Key exists
        `InterruptedException` - Operation interrupted exception
        `ServiceNotAvailableException` - Service is not Up

    - #### getKeys

          List<String> getKeys(String appName)
                               throws ServiceNotAvailableException,
                                      InterruptedException

      Query for list of key strings for a application name stored in the distributed KeyStore. DataNodes corresponding to each key can be queried through getNode() routine.
      Parameters:
        `appName` - Application name
      Returns:
        List of keys
      Throws:
        `InterruptedException` - Operation interrupted exception
        `ServiceNotAvailableException` - Service is not Up

Copyright © 2014. All Rights Reserved.