smos-application 0.1.5

SMOS application layer — use cases and port traits.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! `IdGenerator` port — injectable source of fresh session ids.
//!
//! Production code uses `SystemIdGenerator` from `smos`; tests
//! inject a fake so the ids are predictable. The port exists so the
//! domain stays free of the `SessionId::new()` constructor (reading
//! system entropy is an IO concern — same layering rule that motivates
//! the [`Clock`] port for wall-clock time).
//!
//! [`Clock`]: super::Clock

use smos_domain::SessionId;

/// Fresh-session-id boundary.
pub trait IdGenerator {
    /// Mint a fresh, never-before-seen session id.
    fn new_session_id(&self) -> SessionId;
}