Skip to main content

Module store_kv

Module store_kv 

Source
Expand description

Shared plumbing for the store-* nodes.

Store resolution happens once, at policy-compile time: the node holds the resulting handle and nothing reads the registry on the request path. This is the pattern limit-count established (src/plugins/native/limit_count.rs).

Structs§

StoreHandle
A resolved store, held by a node for its lifetime.

Functions§

is_value_type_error
True when a redis error reflects a value/type problem rather than an outage: a command applied to a key holding the wrong type (WRONGTYPE, surfaced by the crate as an ExtensionError with that code), or a numeric operation against a non-numeric value (ERR value is not an integer or out of range). Both are data faults store-incr reports as STORE_VALUE_INVALID, never STORE_ERROR.
key_invalid
A key template that rendered to nothing.
namespaced_key
Builds the full redis key for a rendered policy key.
optional_seconds
Parses an optional positive duration in seconds.
optional_ttl
Parses the optional ttl_seconds. Absent means no expiry; 0 is rejected.
prepare_error_response 🔒
Prepares the response common to every store-node error before it exits the node’s error port: status + JSON body + content-type, the same shape limit-count and the session plugins already use (e.g. authz_casdoor::store_error, limit_count.rs’s RATE_LIMIT_UNAVAILABLE branch).
required_template
Parses a required, templated string field.
resolve
Resolves the store config key to a handle, at construction time.
store_error
A store outage. Never conflated with a miss: see the spec’s §7. Prepares a 503 – the dependency is unavailable, not the caller’s fault – so a policy that wires error -> client cannot fail open with a 200.
value_invalid
A value that exists but is not usable as configured (bad JSON, non-numeric). Prepares a 500: a data/config fault, not an outage.