orbit_core/lib.rs
1//! # `orbit-core` — fleet-aware shared memory
2//!
3//! ## What this crate is
4//!
5//! Fleet-shared same-host runtime storage between workers.
6//!
7//! Every process in the fleet is an equal member. There is no master,
8//! no worker — only peers. Whatever role distinction matters to the
9//! embedder is the embedder's concern; not Orbit's.
10//!
11//! ## Status — first light (V0)
12//!
13//! V0 ships fixed-capacity append logs and current-state tables with POSIX
14//! shared-memory backing on Unix. Semantic layers choose the shape that
15//! matches their data: history belongs in rings; current leases do not.
16
17pub mod epoch;
18pub mod error;
19pub mod fleet;
20pub mod ring;
21#[cfg(unix)]
22pub mod shm;
23
24pub mod id {
25 //! Re-export of the standalone `netid64` primitive.
26
27 pub use netid64::{NetId64, ParseNetId64Error};
28}
29
30#[cfg(unix)]
31pub mod ring_shm {
32 //! Compatibility module for the pre-`ring::shm` layout.
33 pub use crate::ring::shm::*;
34}
35
36pub use epoch::OrbitEpoch;
37pub use error::{Error, Result};
38pub use fleet::{Fleet, NodeId};
39pub use id::{NetId64, ParseNetId64Error};
40#[cfg(any(target_os = "linux", target_os = "freebsd"))]
41pub use ring::RingEventFd;
42pub use ring::cursor::{RingCursor, RingFrameSource, RingLoss, RingPoll, RingRead, poll_ring};
43pub use ring::{Frame, Ring, RingSpec, RingTopology};
44
45/// Marker for a type that has a stable wire identity across the fleet.
46///
47/// Required bounds:
48/// - `Clone` — values may be delivered to multiple subscribers / nodes.
49/// - `Send + Sync + 'static` — values cross thread / process boundaries.
50pub trait OrbitTyped: Clone + Send + Sync + 'static {
51 /// Stable wire identifier. Hand-picked in V0; build.rs-generated later.
52 const KIND: u8;
53
54 /// Ring layout and retention policy for this wire kind.
55 ///
56 /// This is part of the cross-process wire contract. Reusing a KIND
57 /// with a different spec is an error.
58 const RING_SPEC: RingSpec;
59}