FerricStore.BatchWorker (ferricstore v0.4.0)

Copy Markdown View Source

Persistent process for erpc batch operations.

Instead of spawning a new process per erpc.call, clients start a long-lived worker on the remote node and send batches via GenServer.call/2 over Erlang distribution. This eliminates per-call process spawn overhead and distribution codec setup.

No Ranch, no TCP, no RESP parsing -- just distribution to Router.

Usage (from remote node)

# Start a worker on the FerricStore node (once per client process)
{:ok, pid} = :erpc.call(node, FerricStore.BatchWorker, :start, [])

# Send batches -- reuses the same process
values = GenServer.call(pid, {:batch_get, keys})
results = GenServer.call(pid, {:batch_set, kv_pairs})
results = GenServer.call(pid, {:batch_mixed, pipe_commands})

# When done
GenServer.stop(pid)

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start()

@spec start() :: GenServer.on_start()