Skip to main content

Module session_manager

Module session_manager 

Source
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§

DistributedSessionManager
Manages concurrent distributed inference sessions.
PeerId
Opaque identifier for a remote peer participating in a session.
SessionId
128-bit random session identifier.
SessionMetrics
Atomic counters tracking aggregate session outcomes.
SessionMetricsSnapshot
A point-in-time copy of SessionMetrics with plain u64 fields.

Enums§

SessionError
Error type for all session manager operations.
SessionStatus
Lifecycle state of a distributed inference session.

Constants§

MAX_CONCURRENT_SESSIONS
Maximum number of concurrent sessions the manager will accept.