FauxRedis.Connection (faux_redis v1.0.2)

Copy Markdown View Source

Per-client connection process.

Each accepted TCP socket is owned by a FauxRedis.Connection process, which is responsible for:

  • reading bytes from the socket and buffering them
  • decoding RESP frames (including pipelined commands)
  • sending commands to FauxRedis.Server
  • applying response specifications (including delays, timeouts, closes, partial/protocol-error replies)
  • handling server-side pub/sub messages

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

t()

@type t() :: %FauxRedis.Connection{
  buffer: binary(),
  closed?: boolean(),
  conn_id: non_neg_integer() | nil,
  db: non_neg_integer(),
  ets_kv: term(),
  mode: atom(),
  server: pid() | nil,
  socket: port() | nil
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(server, conn_id)

@spec start_link(pid(), non_neg_integer()) :: GenServer.on_start()

start_link(server, socket, conn_id)

@spec start_link(pid(), port(), non_neg_integer()) :: GenServer.on_start()