View Source Ravix.Connection.State.Manager (ravix v0.0.3)

Manages the state of a RavenDB Store connection

Link to this section Summary

Functions

Helper method to wrap the Ravix.Store into it's connection identifier

Initializes a Store Connection

Request the topology for the informed database store, receives a list of the Executors PIDs and the database name.

Updates the topology for the informed connection state.

Link to this section Functions

@spec connection_id(atom()) :: {:via, Registry, {:connections, atom()}}

Helper method to wrap the Ravix.Store into it's connection identifier

Initializes a Store Connection

First it register the nodes executors for the connection, then it pools the RavenDB asking for a topology update.

Returns Ravix.Connection.State

Raises if it's unable to register at least one node and if the topology is invalid

Link to this function

request_topology(node_pids, database)

View Source
@spec request_topology([pid()], String.t()) ::
  {:error, :invalid_cluster_topology} | {:ok, Ravix.Connection.Topology.t()}

Request the topology for the informed database store, receives a list of the Executors PIDs and the database name.

Returns:

  • {:ok, Ravix.Connection.Topology} if the topology request was successful
  • {:error, :invalid_cluster_topology} if it fails to pool the topology
@spec update_topology(Ravix.Connection.State.t()) ::
  {:error, any()} | {:ok, Ravix.Connection.State.t()}

Updates the topology for the informed connection state.

Returns:

- `{:ok, Ravix.Connection.State}` with the topology updated
- `{:error, cause}` if it was unable to update the topology