Defines a filter for processing Redis commands in replica before and after callback execution.
Filters can modify commands, add context, or skip commands entirely. The context map in ReplicaCommand can be used to pass data between pre_handle and post_handle.
Summary
Functions
Applies the filter to the list of replica commands. Used internally by the replica.
Applies the filter to the list of replica commands. Used internally by the replica.
Combines two filters into a single filter.
Default post_handle that does nothing.
Default pre_handle that passes the command through unchanged.
Types
@type post_handle() :: (Vdr.RedisStream.ReplicaCommand.t(), :ok | {:error, term()} -> :ok)
@type pre_handle() :: (Vdr.RedisStream.ReplicaCommand.t() -> {:ok, Vdr.RedisStream.ReplicaCommand.t()} | :skip)
@type t() :: %Vdr.RedisStream.CommandFilter{ post_handle: post_handle(), pre_handle: pre_handle() }
Functions
Applies the filter to the list of replica commands. Used internally by the replica.
Applies the filter to the list of replica commands. Used internally by the replica.
Combines two filters into a single filter.
The outer filter's pre_handle runs first, then the inner filter's pre_handle. Post-handles run in reverse order (inner first, then outer).
If either pre_handle returns :skip, the combined filter returns :skip.
Default post_handle that does nothing.
Default pre_handle that passes the command through unchanged.