net.corda.node.services.transactions

## Class RaftUniquenessProvider

- SingletonSerializeAsToken
- - net.corda.node.services.transactions.RaftUniquenessProvider

- All Implemented Interfaces:
    SerializeAsToken, UniquenessProvider

      public class RaftUniquenessProvider
      extends SingletonSerializeAsToken
      implements UniquenessProvider

  A uniqueness provider that records committed input states in a distributed collection replicated and persisted in a Raft cluster, using the Copycat framework (http://atomix.io/copycat/).

  The uniqueness provider maintains both a Copycat cluster node (server) and a client through which it can submit requests to the cluster. In Copycat, a client request is first sent to the server it's connected to and then redirected to the cluster leader to be actioned.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RaftUniquenessProvider.Companion`

    - ### Nested classes/interfaces inherited from interface net.corda.core.node.services.UniquenessProvider

      `UniquenessProvider.Conflict, UniquenessProvider.ConsumingTx`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static RaftUniquenessProvider.Companion` | `Companion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RaftUniquenessProvider(java.nio.file.Path storagePath, com.google.common.net.HostAndPort myAddress, java.util.List<com.google.common.net.HostAndPort> clusterAddresses, org.jetbrains.exposed.sql.Database db, SSLConfiguration config)` A uniqueness provider that records committed input states in a distributed collection replicated and persisted in a Raft cluster, using the Copycat framework (http://atomix.io/copycat/).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `commit(java.util.List<net.corda.core.contracts.StateRef> states, SecureHash txId, Party callerIdentity)` Commits all input states of the given transaction

    - ### Methods inherited from class net.corda.core.serialization.SingletonSerializeAsToken

      `toToken`

    - ### Methods inherited from interface net.corda.core.node.services.UniquenessProvider

      `commit`

    - ### Methods inherited from interface net.corda.core.serialization.SerializeAsToken

      `toToken`

- - ### Field Detail

    - #### Companion

          public static RaftUniquenessProvider.Companion Companion

  - ### Constructor Detail

    - #### RaftUniquenessProvider

          public RaftUniquenessProvider(java.nio.file.Path storagePath,
                                        com.google.common.net.HostAndPort myAddress,
                                        java.util.List<com.google.common.net.HostAndPort> clusterAddresses,
                                        org.jetbrains.exposed.sql.Database db,
                                        SSLConfiguration config)

      A uniqueness provider that records committed input states in a distributed collection replicated and persisted in a Raft cluster, using the Copycat framework (http://atomix.io/copycat/).

      The uniqueness provider maintains both a Copycat cluster node (server) and a client through which it can submit requests to the cluster. In Copycat, a client request is first sent to the server it's connected to and then redirected to the cluster leader to be actioned.

      Parameters:
        `storagePath` - Directory storing the Raft log and state machine snapshots
        `myAddress` - Address of the Copycat node run by this Corda node
        `clusterAddresses` - List of node addresses in the existing Copycat cluster. At least one active node must be provided to join the cluster. If empty, a new cluster will be bootstrapped.
        `db` - The database to store the state machine state in
        `config` - SSL configuration

  - ### Method Detail

    - #### commit

          public void commit(java.util.List<net.corda.core.contracts.StateRef> states,
                             SecureHash txId,
                             Party callerIdentity)

      Commits all input states of the given transaction