Expand description
Distributed Inference Session Manager
Production-hardening component for managing concurrent distributed inference sessions with fault tolerance, lifecycle tracking, GC, and atomic metrics collection.
§Overview
DistributedSessionManager acts as the central registry for all
in-flight and recently-completed distributed reasoning sessions.
Each session is identified by a SessionId (a 128-bit random value
rendered as 32 lowercase hex digits).
§Limits
At most MAX_CONCURRENT_SESSIONS (256) sessions may be active at once.
Attempts to exceed this limit return SessionError::CapacityExceeded.
§Garbage Collection
Call DistributedSessionManager::gc_expired_sessions periodically to
remove sessions whose age exceeds the supplied max_age duration.
§Examples
use ipfrs_tensorlogic::session_manager::{
DistributedSessionManager, PeerId, SessionStatus,
};
use std::time::Duration;
let mgr = DistributedSessionManager::new();
let id = mgr.create_session("parent(X, Y)", vec![PeerId::new("peer-1")]).expect("example: should succeed in docs");
// Transition the session to Running
mgr.set_running(&id).expect("example: should succeed in docs");
// Inspect status
assert!(matches!(mgr.session_status(&id), Some(SessionStatus::Running { .. })));
// Cancel it
mgr.cancel_session(&id).expect("example: should succeed in docs");
assert!(matches!(mgr.session_status(&id), Some(SessionStatus::Cancelled)));
// GC sessions older than 1 second
mgr.gc_expired_sessions(Duration::from_secs(1));Structs§
- Distributed
Session Manager - Manages concurrent distributed inference sessions.
- PeerId
- Opaque identifier for a remote peer participating in a session.
- Session
Id - 128-bit random session identifier.
- Session
Metrics - Atomic counters tracking aggregate session outcomes.
- Session
Metrics Snapshot - A point-in-time copy of
SessionMetricswith plainu64fields.
Enums§
- Session
Error - Error type for all session manager operations.
- Session
Status - Lifecycle state of a distributed inference session.
Constants§
- MAX_
CONCURRENT_ SESSIONS - Maximum number of concurrent sessions the manager will accept.