Skip to main content

Module state_utils

Module state_utils 

Source
Available on crate feature sessions only.
Expand description

Shared utilities for extracting and merging state deltas across backends. Shared state utility functions for session backends.

These functions implement the three-tier state model used by all session backends (SQLite, PostgreSQL, Redis). Keys are partitioned by prefix:

  • app: → app-level state (prefix stripped)
  • user: → user-level state (prefix stripped)
  • temp: → ephemeral, dropped on persistence
  • everything else → session-level state

Functions§

extract_state_deltas
Split a flat state map into (app, user, session) tiers.
merge_states
Merge three state tiers back into a flat map with prefixes restored.