Raxol.Core.StateManager
(Raxol v2.3.0)
View Source
Consolidated state management module providing functional, process-based, and ETS-backed state handling.
This module provides multiple state management strategies with automatic selection:
- Functional: Simple map-based transformations (no processes)
- Process-based: Supervised GenServer state with Agent or GenServer backing
- ETS-backed: High-performance state with ETS storage for large datasets
- Domain-specific: Delegation to specialized domain managers
Configuration
Set the default strategy in application config:
config :raxol, :state_manager,
default_strategy: :functional, # :functional, :process, :ets
ets_enabled: true,
process_supervision: trueOr control per-call with options:
StateManager.put(state, :key, value, strategy: :ets)
StateManager.start_managed(:app_state, %{}, strategy: :process)
Summary
Functions
Creates a supervised state manager as part of a supervision tree.
Cleans up state resources.
Clears functional state.
Delegates to domain-specific state manager.
Deletes a key from functional state.
Deletes a state value.
Gets a value from functional state.
Gets a value from functional state with default.
Gets the current managed state.
Gets memory usage statistics.
Gets the current state or a specific key from ETS. When called without arguments, returns the entire state as a map.
Gets the current version number.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_call/3.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Increments the version number.
Initializes state manager with default empty state.
Initializes state manager with options.
Lists all registered state domains.
Merges two functional states.
Puts a value into functional state.
Sets a state value atomically in ETS.
Starts a new managed state with supervision.
Executes a function within a transaction.
Updates a value in functional state using a function.
Updates managed state using a function.
Updates a state value with a function.
Validates functional state.
Types
Functions
Creates a supervised state manager as part of a supervision tree.
Cleans up state resources.
Clears functional state.
Delegates to domain-specific state manager.
Deletes a key from functional state.
Deletes a state value.
Gets a value from functional state.
Options
strategy: atom()- Force specific strategy (:functional, :process, :ets)
Gets a value from functional state with default.
Gets the current managed state.
Gets memory usage statistics.
Gets the current state or a specific key from ETS. When called without arguments, returns the entire state as a map.
Gets the current version number.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_call/3.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Increments the version number.
Initializes state manager with default empty state.
Initializes state manager with options.
Lists all registered state domains.
Merges two functional states.
Puts a value into functional state.
Sets a state value atomically in ETS.
Starts a new managed state with supervision.
Options
strategy: :process | :ets- Choose the backing strategy
Executes a function within a transaction.
Updates a value in functional state using a function.
Updates managed state using a function.
Updates a state value with a function.
Validates functional state.