FerricStore.SDK.Native.Client (ferricstore_sdk v0.4.2)

Copy Markdown View Source

FerricStore native protocol client with topology-aware shard routing.

This public facade performs validation before sending work to the internal coordinator. Socket ownership remains in native connection processes.

Summary

Functions

async_pipeline(client, commands, pipeline_options, opts)

@spec async_pipeline(pid(), list(), keyword(), keyword()) :: reference()

async_request(client, opcode, payload \\ %{}, opts \\ [])

@spec async_request(pid(), non_neg_integer() | atom() | binary(), term(), keyword()) ::
  reference()

async_request_by_key(client, opcode, key, payload, opts \\ [])

@spec async_request_by_key(
  pid(),
  non_neg_integer() | atom() | binary(),
  binary(),
  map(),
  keyword()
) :: reference()

await_event(client, timeout \\ 5000)

@spec await_event(pid(), timeout()) ::
  {:ok, map()}
  | {:error, :client_closed | {:client_unavailable, :invalid_client}}
  | {:error, {:invalid_timeout, term()}}
  | nil

cancel_async(client, owner, ref, timeout \\ 5000)

@spec cancel_async(term(), term(), term(), term()) ::
  :ok | {:error, {:cancel_failed, term()}}

child_spec(opts)

@spec child_spec(keyword()) :: Supervisor.child_spec()

close(client, timeout \\ 5000)

@spec close(pid(), timeout()) ::
  :ok | {:error, {:invalid_client, atom()} | {:close_failed, term()}}

command_exec(client, command, args \\ [], opts \\ [])

@spec command_exec(pid(), binary(), list(), keyword()) ::
  {:ok, term()} | {:error, term()}

from_url(url, opts \\ [])

@spec from_url(
  binary(),
  keyword()
) :: GenServer.on_start()

ping(client, message \\ "PONG", opts \\ [])

@spec ping(pid(), term(), keyword()) :: {:ok, term()} | {:error, term()}

pipeline(client, commands, pipeline_options, opts)

@spec pipeline(pid(), list(), keyword(), keyword()) ::
  {:ok, term()} | {:error, term()}

refresh_topology(client, timeout \\ 5000)

@spec refresh_topology(pid(), timeout()) :: :ok | {:error, term()}

request(client, opcode, payload \\ %{}, opts \\ [])

@spec request(pid(), non_neg_integer() | atom() | binary(), term(), keyword()) ::
  {:ok, term()} | {:error, term()}

request_by_items(client, opcode, items, key_fun, payload_builder, opts \\ [])

@spec request_by_items(
  pid(),
  non_neg_integer() | atom() | binary(),
  list(),
  (term() -> binary()),
  (list() -> map()),
  keyword()
) :: {:ok, [map()]} | {:error, term()}

request_by_key(client, opcode, key, payload, opts \\ [])

@spec request_by_key(
  pid(),
  non_neg_integer() | atom() | binary(),
  binary(),
  map(),
  keyword()
) ::
  {:ok, term()} | {:error, term()}

request_by_keys(client, opcode, keys, payload_builder, opts \\ [])

@spec request_by_keys(
  pid(),
  non_neg_integer() | atom() | binary(),
  [binary()],
  ([binary()] -> map()),
  keyword()
) :: {:ok, [map()]} | {:error, term()}

route(client, key)

@spec route(pid(), term()) :: {:ok, map()} | {:error, term()}

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

subscribe_events(client, events \\ [], opts \\ [])

@spec subscribe_events(pid(), [term()], keyword()) :: {:ok, term()} | {:error, term()}

topology(client)

@spec topology(pid()) :: FerricStore.SDK.Native.Topology.t() | {:error, term()}

unsubscribe_events(client, events \\ [], opts \\ [])

@spec unsubscribe_events(pid(), [term()], keyword()) ::
  {:ok, term()} | {:error, term()}