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 that joins the fleet is an equal member. There is no master,
8//! no worker — only peers. Whatever role distinction matters to the embedder
9//! is the embedder's concern; not Orbit's. Independent observers can instead
10//! attach existing SHM rings read-only, without becoming members.
11//!
12//! ## Status — first light (V0)
13//!
14//! V0 ships fixed-capacity append logs and current-state tables with POSIX
15//! shared-memory backing on Unix. Semantic layers choose the shape that
16//! matches their data: history belongs in rings; current leases do not.
17
18#[doc(hidden)]
19pub mod compile;
20pub mod epoch;
21pub mod error;
22pub mod fleet;
23pub mod readiness;
24pub mod ring;
25#[cfg(unix)]
26pub mod shm;
27pub mod sync;
28
29pub mod id {
30 //! Re-export of the standalone `netid64` primitive.
31
32 pub use netid64::{NetId64, ParseNetId64Error};
33}
34
35#[cfg(unix)]
36pub mod ring_shm {
37 //! Compatibility module for the pre-`ring::shm` layout.
38 pub use crate::ring::shm::*;
39}
40
41pub use epoch::OrbitEpoch;
42pub use error::{Error, Result};
43#[cfg(unix)]
44pub use fleet::FleetObserver;
45pub use fleet::{Fleet, FleetName, InvalidFleetName, NodeId};
46pub use id::{NetId64, ParseNetId64Error};
47pub use ring::cursor::{
48 RingCursor, RingFrameSource, RingLoss, RingPoll, RingRead, poll_ring,
49};
50#[cfg(unix)]
51pub use ring::shm::{ShmRingLaneView, ShmRingMetadata, ShmRingView};
52pub use ring::{Frame, Ring, RingSpec, RingTopology};
53#[cfg(any(
54 target_os = "linux",
55 target_os = "freebsd",
56 target_os = "macos"
57))]
58pub use ring::{ParkedRingEventFd, RingEventFd};
59
60/// Marker for a type that has a stable wire identity across the fleet.
61///
62/// Required bounds:
63/// - `Clone` — values may be delivered to multiple subscribers / nodes.
64/// - `Send + Sync + 'static` — values cross thread / process boundaries.
65pub trait OrbitTyped: Clone + Send + Sync + 'static {
66 /// Stable wire identifier. Hand-picked in V0; build.rs-generated later.
67 const KIND: u8;
68
69 /// Ring layout and retention policy for this wire kind.
70 ///
71 /// This is part of the cross-process wire contract. Reusing a KIND
72 /// with a different spec is an error.
73 const RING_SPEC: RingSpec;
74}