Sign in

    pangbit/moonspoa/agent does not have a README file

    Agent

    pub(all) struct Agent {
    version : String
    max_frame_size : UInt
    capabilities : Array[String]
    handlers : Map[String, (
    Message
    ) -> Array[
    Action
    ] raise]
    on_error : (String, Error) -> Unit?
    }

    Configuration of a SPOA agent: the protocol parameters announced in AGENT-HELLO and the message handlers invoked for NOTIFY frames.

    Agent::new

    fn Agent::new(version? : String, max_frame_size? : UInt, capabilities? : Array[String], on_error? : (String, Error) -> Unit) -> Agent raise
    SpopError

    Create an agent configuration.

    Raises SpopError with UnsupportedVersion if version is not supported by this library, and with InvalidMaxFrameSize if max_frame_size is smaller than 256.

    Agent::on

    Register a handler for messages named name. Returns the agent for builder-style chaining.

    Session

    pub struct Session {
    agent : Agent
    pipelining : Bool
    negotiated_max_frame_size : UInt
    peer_disconnect : (
    StatusCode
    , String)?
    }

    A SPOA agent session on one connection.

    Use Session::run to drive the SPOP protocol state machine over an injected &@io.Reader + &@io.Writer pair.

    Session::negotiated_max_frame_size

    fn Session::negotiated_max_frame_size(self : Session) -> UInt

    The max-frame-size negotiated with the peer (minimum of both announced values).

    Session::new

    fn Session::new(agent : Agent) -> Session

    Session::peer_disconnect

    fn Session::peer_disconnect(self : Session) -> (
    StatusCode
    , String)?

    The status code and message of the peer's HAPROXY-DISCONNECT frame, if one was received.

    Session::pipelining

    fn Session::pipelining(self : Session) -> Bool

    Whether the "pipelining" capability was negotiated with the peer.

    Session::run

    async fn Session::run(self : Session, reader : &
    Reader
    , writer : &
    Writer
    ) -> Unit

    Run the session to completion: HELLO negotiation, the NOTIFY/ACK loop, and the final disconnect exchange.

    Protocol errors are reported to the peer in an AGENT-DISCONNECT frame carrying the matching status code before the session ends. I/O errors and unexpected EOF produce a best-effort AGENT-DISCONNECT(io error). The session returns normally in all these cases; only cancellation propagates.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io