|
Entropic 2.14.3
Local-first agentic inference engine
|
One T per session key, under one leaf mutex (gh#158).
More...
#include <entropic/mcp/session_scoped.h>
Public Member Functions | |
| template<typename Fn > | |
| auto | with (const std::string &key, Fn &&fn) |
Run fn on key's state, creating it empty on first use. | |
| template<typename Fn > | |
| auto | peek (const std::string &key, Fn &&fn) const |
Run fn on key's state WITHOUT creating it. | |
| bool | release (const std::string &key) |
Forget key's state. | |
| std::size_t | session_count () const |
| Sessions currently holding state (bounded-growth probe). | |
One T per session key, under one leaf mutex (gh#158).
Every accessor takes the lock for its whole body and calls nothing but the supplied functor under it, so it is a LEAF lock: nothing that holds it waits on another. A functor must not re-enter the same instance.
| T | Per-session state (default-constructible). |
Definition at line 61 of file session_scoped.h.
|
inline |
Run fn on key's state WITHOUT creating it.
A lookup must not allocate an entry, or merely asking "did this session read X?" would grow the map for sessions that never read.
| key | Session key. |
| fn | Callable taking const T* (nullptr when absent). |
fn returns. @req REQ-LOOP-009 Definition at line 90 of file session_scoped.h.
Forget key's state.
| key | Session key. |
Definition at line 103 of file session_scoped.h.
|
inline |
Sessions currently holding state (bounded-growth probe).
Definition at line 114 of file session_scoped.h.
|
inline |
Run fn on key's state, creating it empty on first use.
| key | Session key. |
| fn | Callable taking T&. |
fn returns. @req REQ-LOOP-009 Definition at line 72 of file session_scoped.h.