Skip to main content

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
17#[doc(hidden)]
18pub mod compile;
19pub mod epoch;
20pub mod error;
21pub mod fleet;
22pub mod ring;
23#[cfg(unix)]
24pub mod shm;
25
26pub mod id {
27    //! Re-export of the standalone `netid64` primitive.
28
29    pub use netid64::{NetId64, ParseNetId64Error};
30}
31
32#[cfg(unix)]
33pub mod ring_shm {
34    //! Compatibility module for the pre-`ring::shm` layout.
35    pub use crate::ring::shm::*;
36}
37
38pub use epoch::OrbitEpoch;
39pub use error::{Error, Result};
40pub use fleet::{Fleet, NodeId};
41pub use id::{NetId64, ParseNetId64Error};
42#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
43pub use ring::RingEventFd;
44pub use ring::cursor::{RingCursor, RingFrameSource, RingLoss, RingPoll, RingRead, poll_ring};
45pub use ring::{Frame, Ring, RingSpec, RingTopology};
46
47/// Marker for a type that has a stable wire identity across the fleet.
48///
49/// Required bounds:
50/// - `Clone` — values may be delivered to multiple subscribers / nodes.
51/// - `Send + Sync + 'static` — values cross thread / process boundaries.
52pub trait OrbitTyped: Clone + Send + Sync + 'static {
53    /// Stable wire identifier. Hand-picked in V0; build.rs-generated later.
54    const KIND: u8;
55
56    /// Ring layout and retention policy for this wire kind.
57    ///
58    /// This is part of the cross-process wire contract. Reusing a KIND
59    /// with a different spec is an error.
60    const RING_SPEC: RingSpec;
61}