capri/lifecycle

Types

pub opaque type StoreHandle

Values

pub fn bind(
  id: atom.Atom,
  directory: String,
) -> Result(StoreHandle, khepri_error.Error)

(If applicable) start store, then connect to the store.

pub fn cluster_nodes(
  store: StoreHandle,
) -> Result(List(node.Node), khepri_error.Error)
pub fn connect(
  id: atom.Atom,
) -> Result(StoreHandle, khepri_error.Error)

Connect to an existing store

You’d likely be better served by bind

pub fn is_running(store: StoreHandle) -> Bool
pub fn reset_and_join_cluster(
  store: StoreHandle,
  peer: node.Node,
) -> Result(StoreHandle, khepri_error.Error)

Erase local data, leave the current cluster, and join new cluster. This is the primary way to join a cluster.

Here be dragons!

Data may already be erased before this function errors.

pub fn reset_local_member(
  store: StoreHandle,
) -> Result(Nil, khepri_error.Error)

Reset this local cluster member.

Leaves cluster and erases local data.

pub fn start(
  id: atom.Atom,
  directory: String,
) -> Result(StoreHandle, khepri_error.Error)

Start a store

You’d likely be better served by bind

pub fn stop(
  store: StoreHandle,
) -> Result(Nil, khepri_error.Error)

Stop store

pub fn wait_until_ready(
  store: StoreHandle,
  timeout_ms: Int,
) -> Result(StoreHandle, khepri_error.Error)

Wait until store leader election completes

Search Document