liminal-cli 0.3.1

The liminal command: serve the network, maintain its stores, or serve its discovery MCP over stdio
Documentation
//! The long-lived tap contract, with reception separated from its close signal.

use super::RailError;
use serde_json::Value;
use std::fmt::Debug;
use std::sync::Arc;

/// A blocking tap reader. One receive consumes one wire record.
pub trait TapReader: Debug + Send {
    /// Blocks until a record arrives or the subscription ends.
    ///
    /// # Errors
    /// Returns the reader's terminal or decoding failure in words.
    fn receive(&self) -> Result<Value, RailError>;
}

/// A separately held signal that releases a blocked tap reader.
pub trait TapCloser: Debug + Send + Sync {
    /// Ends the subscription without a timer or another record.
    ///
    /// # Errors
    /// Returns the close failure, after signaling every wait it owns.
    fn close(&self) -> Result<(), RailError>;
}

/// A reader and its independently held close signal.
#[derive(Debug)]
pub struct TapSubscription {
    /// The owned, blocking receive half.
    pub reader: Box<dyn TapReader>,
    /// The close signal, shareable with service teardown.
    pub closer: Arc<dyn TapCloser>,
}