barrel_rep_filter (barrel_docdb v1.1.1)

View Source

Wire codec for replication filters (paths, query, channel).

Query conditions are Erlang tuples; on the wire they become tagged JSON arrays whitelisted 1:1 against the engine forms, e.g. ["path", ["type"], "user"] or ["compare", ["rank"], ">", 3]. Decoding uses explicit clauses only: no atoms are created from wire input, unknown tags reject with {bad_filter, _}. The one lossy spot: the wildcard path component `*'' rides as the string "*" (a doc field literally named "*" cannot be addressed through a wire filter).

The same codec serializes filters for replication-task persistence.

Summary

Functions

from_wire(Wire)

-spec from_wire(map()) -> {ok, map()} | {error, {bad_filter, term()}}.

to_wire(Filter)

-spec to_wire(map()) -> map().