Package org.apache.storm.cluster

## Class PaceMakerStateStorage

- java.lang.Object
- - org.apache.storm.cluster.PaceMakerStateStorage

- All Implemented Interfaces:
    `Closeable`, `AutoCloseable`, `IStateStorage`

      public class PaceMakerStateStorage
      extends Object
      implements IStateStorage

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PaceMakerStateStorage​(PacemakerClientPool pacemakerClientPool, IStateStorage stateStorage)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add_listener​(org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener listener)` | Add a StateStorageListener to the connection.
    `void` | `close()` | Close the connection to the data store.
    `String` | `create_sequential​(String path, byte[] data, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)` | Path will be appended with a monotonically increasing integer, a new node will be created there, and data will be put at that node.
    `void` | `delete_node​(String path)` | Deletes the node at a given path, and any child nodes that may exist.
    `void` | `delete_node_blobstore​(String path, String nimbusHostPortInfo)` | Allows us to delete the znodes within /storm/blobstore/key_name whose znodes start with the corresponding nimbusHostPortInfo.
    `void` | `delete_worker_hb​(String path)` | Deletes the heartbeat at a given path, and any child nodes that may exist.
    `List<String>` | `get_children​(String path, boolean watch)` | Get a list of paths of all the child nodes which exist immediately under path.
    `byte[]` | `get_data​(String path, boolean watch)` | Get the data from the node at path
    `VersionedData<byte[]>` | `get_data_with_version​(String path, boolean watch)` | Get the data at the node along with its version.
    `Integer` | `get_version​(String path, boolean watch)` | Gets the 'version' of the node at a path.
    `byte[]` | `get_worker_hb​(String path, boolean watch)` | Get the heartbeat from the node at path
    `List<String>` | `get_worker_hb_children​(String path, boolean watch)` | Get a list of paths of all the child nodes which exist immediately under path.
    `void` | `mkdirs​(String path, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)` | Creates nodes for path and all its parents.
    `boolean` | `node_exists​(String path, boolean watch)` | Check if a node exists and optionally set a watch on the path.
    `String` | `register​(ZKStateChangedCallback callback)` | Registers a callback function that gets called when CuratorEvents happen.
    `void` | `set_data​(String path, byte[] data, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)` | Set the value of the node at path to data.
    `void` | `set_ephemeral_node​(String path, byte[] data, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)` | Creates an ephemeral node at path.
    `void` | `set_worker_hb​(String path, byte[] data, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)` | Write a worker heartbeat at the path.
    `void` | `sync_path​(String path)` | Force consistency on a path.
    `void` | `unregister​(String id)` | Unregisters a callback function that was registered with register(...).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PaceMakerStateStorage

          public PaceMakerStateStorage​(PacemakerClientPool pacemakerClientPool,
                                       IStateStorage stateStorage)
                                throws Exception

      Throws:
        `Exception`

  - ### Method Detail

    - #### register

          public String register​(ZKStateChangedCallback callback)

      Description copied from interface: `IStateStorage`
      Registers a callback function that gets called when CuratorEvents happen.
      Specified by:
        `register` in interface `IStateStorage`
      Parameters:
        `callback` - is a clojure IFn that accepts the type - translated to clojure keyword as in zookeeper - and the path: (callback type path)
      Returns:
        is an id that can be passed to unregister(...) to unregister the callback.

    - #### unregister

          public void unregister​(String id)

      Description copied from interface: `IStateStorage`
      Unregisters a callback function that was registered with register(...).
      Specified by:
        `unregister` in interface `IStateStorage`
      Parameters:
        `id` - is the String id that was returned from register(...).

    - #### create_sequential

          public String create_sequential​(String path,
                                          byte[] data,
                                          List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)

      Description copied from interface: `IStateStorage`
      Path will be appended with a monotonically increasing integer, a new node will be created there, and data will be put at that node.
      Specified by:
        `create_sequential` in interface `IStateStorage`
      Parameters:
        `path` - The path that the monotonically increasing integer suffix will be added to.
        `data` - The data that will be written at the suffixed path's node.
        `acls` - The acls to apply to the path. May be null.
      Returns:
        The path with the integer suffix appended.

    - #### mkdirs

          public void mkdirs​(String path,
                             List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)

      Description copied from interface: `IStateStorage`
      Creates nodes for path and all its parents. Path elements are separated by a "/", as in *nix filesystem notation. Equivalent to mkdir -p in *nix.
      Specified by:
        `mkdirs` in interface `IStateStorage`
      Parameters:
        `path` - The path to create, along with all its parents.
        `acls` - The acls to apply to the path. May be null.

    - #### delete_node

          public void delete_node​(String path)

      Description copied from interface: `IStateStorage`
      Deletes the node at a given path, and any child nodes that may exist.
      Specified by:
        `delete_node` in interface `IStateStorage`
      Parameters:
        `path` - The path to delete

    - #### set_ephemeral_node

          public void set_ephemeral_node​(String path,
                                         byte[] data,
                                         List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)

      Description copied from interface: `IStateStorage`
      Creates an ephemeral node at path. Ephemeral nodes are destroyed by the store when the client disconnects.
      Specified by:
        `set_ephemeral_node` in interface `IStateStorage`
      Parameters:
        `path` - The path where a node will be created.
        `data` - The data to be written at the node.
        `acls` - The acls to apply to the path. May be null.

    - #### get_version

          public Integer get_version​(String path,
                                     boolean watch)
                              throws Exception

      Description copied from interface: `IStateStorage`
      Gets the 'version' of the node at a path. Optionally sets a watch on that node. The version should increase whenever a write happens.
      Specified by:
        `get_version` in interface `IStateStorage`
      Parameters:
        `path` - The path to get the version of.
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        The integer version of this node.
      Throws:
        `Exception`

    - #### node_exists

          public boolean node_exists​(String path,
                                     boolean watch)

      Description copied from interface: `IStateStorage`
      Check if a node exists and optionally set a watch on the path.
      Specified by:
        `node_exists` in interface `IStateStorage`
      Parameters:
        `path` - The path to check for the existence of a node.
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        Whether or not a node exists at path.

    - #### get_children

          public List<String> get_children​(String path,
                                           boolean watch)

      Description copied from interface: `IStateStorage`
      Get a list of paths of all the child nodes which exist immediately under path.
      Specified by:
        `get_children` in interface `IStateStorage`
      Parameters:
        `path` - The path to look under
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        list of string paths under path.

    - #### close

          public void close()

      Description copied from interface: `IStateStorage`
      Close the connection to the data store.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `IStateStorage`

    - #### set_data

          public void set_data​(String path,
                               byte[] data,
                               List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)

      Description copied from interface: `IStateStorage`
      Set the value of the node at path to data.
      Specified by:
        `set_data` in interface `IStateStorage`
      Parameters:
        `path` - The path whose node we want to set.
        `data` - The data to put in the node.
        `acls` - The acls to apply to the path. May be null.

    - #### get_data

          public byte[] get_data​(String path,
                                 boolean watch)

      Description copied from interface: `IStateStorage`
      Get the data from the node at path
      Specified by:
        `get_data` in interface `IStateStorage`
      Parameters:
        `path` - The path to look under
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        The data at the node.

    - #### get_data_with_version

          public VersionedData<byte[]> get_data_with_version​(String path,
                                                             boolean watch)

      Description copied from interface: `IStateStorage`
      Get the data at the node along with its version. Data is returned in an Map with the keys data and version.
      Specified by:
        `get_data_with_version` in interface `IStateStorage`
      Parameters:
        `path` - The path to look under
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        the data with a version

    - #### set_worker_hb

          public void set_worker_hb​(String path,
                                    byte[] data,
                                    List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)

      Description copied from interface: `IStateStorage`
      Write a worker heartbeat at the path.
      Specified by:
        `set_worker_hb` in interface `IStateStorage`
      Parameters:
        `path` - The path whose node we want to set.
        `data` - The data to put in the node.
        `acls` - The acls to apply to the path. May be null.

    - #### get_worker_hb

          public byte[] get_worker_hb​(String path,
                                      boolean watch)

      Description copied from interface: `IStateStorage`
      Get the heartbeat from the node at path
      Specified by:
        `get_worker_hb` in interface `IStateStorage`
      Parameters:
        `path` - The path to look under
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        The heartbeat at the node.

    - #### get_worker_hb_children

          public List<String> get_worker_hb_children​(String path,
                                                     boolean watch)

      Description copied from interface: `IStateStorage`
      Get a list of paths of all the child nodes which exist immediately under path. This is similar to get_children, but must be used for any nodes
      Specified by:
        `get_worker_hb_children` in interface `IStateStorage`
      Parameters:
        `path` - The path to look under
        `watch` - Whether or not to set a watch on the path. Watched paths emit events which are consumed by functions registered with the register method. Very useful for catching updates to nodes.
      Returns:
        list of string paths under path.

    - #### delete_worker_hb

          public void delete_worker_hb​(String path)

      Description copied from interface: `IStateStorage`
      Deletes the heartbeat at a given path, and any child nodes that may exist.
      Specified by:
        `delete_worker_hb` in interface `IStateStorage`
      Parameters:
        `path` - The path to delete.

    - #### add_listener

          public void add_listener​(org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener listener)

      Description copied from interface: `IStateStorage`
      Add a StateStorageListener to the connection.
      Specified by:
        `add_listener` in interface `IStateStorage`
      Parameters:
        `listener` - A StateStorageListener to handle changing cluster state events.

    - #### sync_path

          public void sync_path​(String path)

      Description copied from interface: `IStateStorage`
      Force consistency on a path. Any writes committed on the path before this call will be completely propagated when it returns.
      Specified by:
        `sync_path` in interface `IStateStorage`
      Parameters:
        `path` - The path to synchronize.

    - #### delete_node_blobstore

          public void delete_node_blobstore​(String path,
                                            String nimbusHostPortInfo)

      Description copied from interface: `IStateStorage`
      Allows us to delete the znodes within /storm/blobstore/key_name whose znodes start with the corresponding nimbusHostPortInfo.
      Specified by:
        `delete_node_blobstore` in interface `IStateStorage`
      Parameters:
        `path` - /storm/blobstore/key_name
        `nimbusHostPortInfo` - Contains the host port information of a nimbus node.