Ferricstore.Commands.Dispatcher (ferricstore v0.10.1)

Copy Markdown View Source

Routes Redis command names to the appropriate handler module.

The dispatcher normalises the command name to uppercase and delegates to one of:

Multi-word commands (CLIENT, COMMAND) are routed based on the first word, then the subcommand is extracted from args. CLIENT subcommands require connection state and are dispatched via dispatch_client/3.

Unknown commands return {:error, "ERR unknown command ..."}.

Summary

Functions

Dispatches a command AST produced by the native AST parser.

Dispatches an already prepared command without repeating parsing or key discovery.

Dispatches a raw command name and argument list through the canonical command AST dispatcher.

Prepares a raw command once for parsing, key authorization, and routing.

Functions

dispatch_ast(ast, store)

@spec dispatch_ast(term(), map()) :: term()

Dispatches a command AST produced by the native AST parser.

dispatch_prepared(prepared, store, opts \\ [])

@spec dispatch_prepared(Ferricstore.Commands.PreparedCommand.t(), map(), keyword()) ::
  term()

Dispatches an already prepared command without repeating parsing or key discovery.

dispatch_raw(name, args, store)

@spec dispatch_raw(binary(), [term()], map()) :: term()

Dispatches a raw command name and argument list through the canonical command AST dispatcher.

prepare_raw(name, args, opts \\ [])

@spec prepare_raw(binary(), [term()], keyword()) ::
  {:ok, Ferricstore.Commands.PreparedCommand.t()} | {:error, binary()}

Prepares a raw command once for parsing, key authorization, and routing.