RestoreHookContext#

class brainstate.RestoreHookContext(operation, state_ref, timestamp=<factory>, metadata=<factory>, value=None, old_value=None)[source]#

Context for restore hooks.

This context is passed to hooks registered for ‘restore’ operations (when state.restore_value() is called). It provides both the restored value and the previous value for comparison.

Restore hooks can inspect and log the restoration but cannot modify the value or cancel the operation (restoration is considered atomic).

value#

The new value being restored

old_value#

The previous value before restoration