moonbitstack/moonrpc/service does not have a README file

    ChannelNode

    pub(all) struct ChannelNode {
    id : Int
    target : String
    calls : Counters
    state : String
    messages_sent : Int64
    messages_received : Int64
    sockets : Array[Int]
    }

    One channel as channelz sees it: its target, connectivity state, call counts, how many messages each way it has carried, and the sockets under it.

    Counters

    pub(all) struct Counters {
    started : Int64
    succeeded : Int64
    failed : Int64
    }

    The call counters channelz keeps for one scope: how many began, and how they ended.

    Counters::new

    fn Counters::new() -> Counters

    A zeroed counter triple.

    Counters::record

    Fold one RPC event into the counters: a begin counts as started, an end as a success or a failure by its status. Other events leave the call counts alone.

    HealthService

    pub struct HealthService {
    statuses : Map[String, ServingStatus]
    }

    A grpc.health.v1.Health service backed by a per-service status table. The empty key "" is the overall-server status; a fresh service reports the whole server SERVING.

    HealthService::check

    fn HealthService::check(self : HealthService, service : String) -> ServingStatus

    The serving status of a named service: its set status, or ServiceUnknown when the service was never registered.

    HealthService::handlers

    The (path, handler) pairs implementing the service: Check as a unary method and Watch as a server-streaming method that emits the current status. A live Watch that also pushes on every later change needs a streaming source the pure engine's eager ServerStreaming shape does not model, so this emits the status at subscribe time — the first message a real Watch always sends.

    HealthService::install

    Register Check and Watch on a pure server engine.

    HealthService::new

    A health service reporting the overall server as SERVING.

    HealthService::set_status

    fn HealthService::set_status(self : HealthService, service : String, status : ServingStatus) -> Unit

    Set the serving status of a named service (or the overall server with "").

    ReflectionRequest

    pub(all) enum ReflectionRequest {
    ListServices(String)
    FileByFilename(String)
    FileContainingSymbol(String)
    FileContainingExtension(String, Int)
    AllExtensionNumbers(String)
    Unsupported
    } derive(Eq)

    A decoded ServerReflectionRequest, reduced to the one message_request oneof arm that was set. Extension-number queries are surfaced as Unsupported, which the service answers with an UNIMPLEMENTED error response.

    ReflectionRequest::equal

    ReflectionRequest::not_equal

    fn ReflectionRequest::not_equal(x : ReflectionRequest, y : ReflectionRequest) -> Bool

    ReflectionResponse

    pub(all) enum ReflectionResponse {
    ServiceList(Array[String])
    FileDescriptors(Array[Bytes])
    ExtensionNumbers(String, Array[Int])
    ReflectionError(Int, String)
    } derive(Eq)

    A decoded ServerReflectionResponse, reduced to the one message_response arm.

    ReflectionResponse::equal

    ReflectionResponse::not_equal

    ReflectionService

    pub struct ReflectionService {
    files : Array[
    FileDescriptor
    ]
    by_symbol : Map[String, Int]
    by_filename : Map[String, Int]
    services : Array[String]
    }

    A grpc.reflection.v1.ServerReflection service backed by an in-memory descriptor database. Each added FileDescriptor is indexed by filename and by every symbol (package.Service / package.Message) it defines, so a FileContainingSymbol or FileByFilename query resolves to the right file, and ListServices enumerates every registered service.

    ReflectionService::add_file

    Register a file descriptor: index it by filename and by each symbol it defines, and add its services to the ListServices set.

    ReflectionService::handle

    fn ReflectionService::handle(self : ReflectionService, request : Bytes) -> Bytes

    Answer one ServerReflectionRequest (raw bytes) with the encoded ServerReflectionResponse. A decode failure or an unknown symbol/filename yields an ErrorResponse rather than raising, since it rides a non-raising stream handler.

    ReflectionService::handler

    The bidi handler backing ServerReflectionInfo: one response per request, none at half-close.

    ReflectionService::install

    Register ServerReflectionInfo at both the v1 and v1alpha paths on a pure server engine.

    ReflectionService::new

    An empty reflection service. Add the descriptors of the services you serve with add_file.

    Registry

    pub(all) struct Registry {
    channels : Map[Int, ChannelNode]
    subchannels : Map[Int, SubchannelNode]
    sockets : Map[Int, SocketNode]
    servers : Map[Int, ServerNode]
    next : Int
    }

    A registry of the channels, subchannels, sockets and servers a program wants to watch. handler builds a stats handler bound to one node, so a caller attaches it to the channel or server that node describes.

    Registry::add_channel

    fn Registry::add_channel(self : Registry, target : String) -> Int

    Register a channel with target, give it one socket, and return the channel id.

    Registry::add_server

    fn Registry::add_server(self : Registry) -> Int

    Register a server and return its id.

    Registry::add_server_socket

    fn Registry::add_server_socket(self : Registry, id : Int, address : String) -> Int

    Give server id a listening socket at address and return the socket id.

    Registry::add_subchannel

    fn Registry::add_subchannel(self : Registry, parent : Int, address : String) -> Int

    Register a subchannel under parent for address, give it one socket, and return the subchannel id.

    Registry::channel

    fn Registry::channel(self : Registry, id : Int) -> ChannelNode?

    The channel a registry knows by id.

    Registry::channel_handler

    A stats handler that folds a channel's events into node id and its socket.

    Registry::channels

    fn Registry::channels(self : Registry) -> Array[ChannelNode]

    Every channel the registry holds, in id order — the snapshot a channelz reader sees.

    Registry::new

    fn Registry::new() -> Registry

    An empty registry; ids start at 1, as channelz's do.

    Registry::server

    fn Registry::server(self : Registry, id : Int) -> ServerNode?

    The server a registry knows by id.

    Registry::server_handler

    A stats handler that folds a server's events into node id.

    Registry::servers

    fn Registry::servers(self : Registry) -> Array[ServerNode]

    Every server the registry holds, in id order.

    Registry::socket

    fn Registry::socket(self : Registry, id : Int) -> SocketNode?

    The socket a registry knows by id.

    Registry::socket_handler

    A stats handler that folds a socket's events into node id.

    Registry::sockets

    fn Registry::sockets(self : Registry) -> Array[SocketNode]

    Every socket, in id order.

    Registry::sockets_of

    fn Registry::sockets_of(self : Registry, id : Int) -> Array[SocketNode]

    The sockets whose parent is id, in id order.

    Registry::subchannel

    fn Registry::subchannel(self : Registry, id : Int) -> SubchannelNode?

    The subchannel a registry knows by id.

    Registry::subchannels

    fn Registry::subchannels(self : Registry) -> Array[SubchannelNode]

    Every subchannel, in id order.

    ServerNode

    pub(all) struct ServerNode {
    id : Int
    calls : Counters
    listen_sockets : Array[Int]
    }

    One server as channelz sees it: its call counts and the sockets it listens on.

    ServingStatus

    pub(all) enum ServingStatus {
    StatusUnknown
    Serving
    NotServing
    ServiceUnknown
    } derive(Eq)

    The grpc.health.v1.HealthCheckResponse.ServingStatus enum.

    ServingStatus::code

    fn ServingStatus::code(self : ServingStatus) -> Int

    The wire value of a serving status (the protobuf enum number).

    ServingStatus::equal

    ServingStatus::not_equal

    fn ServingStatus::not_equal(x : ServingStatus, y : ServingStatus) -> Bool

    ServingStatus::of

    fn ServingStatus::of(n : Int) -> ServingStatus

    The serving status for a protobuf enum number; out-of-range numbers read as StatusUnknown.

    SocketNode

    pub(all) struct SocketNode {
    id : Int
    address : String
    parent : Int
    streams : Counters
    messages_sent : Int64
    messages_received : Int64
    }

    One socket: the connection a channel or a server holds, with stream and message counters. parent is the channel or server it belongs to.

    SubchannelNode

    pub(all) struct SubchannelNode {
    id : Int
    address : String
    parent : Int
    calls : Counters
    state : String
    messages_sent : Int64
    messages_received : Int64
    sockets : Array[Int]
    }

    One subchannel: a resolved address under a channel, with its own connectivity and counters.

    bidi

    A bidirectional-streaming handler over message types that answers once the client half-closes: every request decoded, the replies encoded in order.

    bidi_each

    A bidirectional-streaming handler over message types that answers as each request arrives: f gives the replies to one request, sent at once, and end the replies to send when the client half-closes.

    client_streaming

    A client-streaming handler over message types: every request decoded, one reply encoded.

    decode_health_request

    fn decode_health_request(msg : Bytes) -> Bytes

    Decode the service field of a HealthCheckRequest, or empty bytes when the field is absent (the overall-server check). Unknown fields are skipped.

    decode_health_response

    fn decode_health_response(msg : Bytes) -> ServingStatus

    Decode the status field of a HealthCheckResponse; an absent field reads as the 0 default (StatusUnknown).

    decode_reflection_request

    fn decode_reflection_request(body : Bytes) -> ReflectionRequest raise
    PbError

    Decode a ServerReflectionRequest down to its message_request oneof arm. host (field 1) is accepted and ignored; an unset oneof reads as Unsupported.

    decode_reflection_response

    fn decode_reflection_response(body : Bytes) -> ReflectionResponse raise
    PbError

    Decode a ServerReflectionResponse down to its message_response arm — the half an in-process reflection client (and the tests) needs to read an answer.

    encode_health_request

    fn encode_health_request(service : Bytes) -> Bytes

    Encode a HealthCheckRequest: field 1 (service, a length-delimited string). An empty service name encodes to the empty message, the wire form of the overall-server check.

    encode_health_response

    fn encode_health_response(status : ServingStatus) -> Bytes

    Encode a HealthCheckResponse: field 1 (status, a varint enum). The SERVING default 0 still encodes to the empty message per protobuf default-omission.

    encode_reflection_request

    fn encode_reflection_request(req : ReflectionRequest) -> Bytes

    Encode a ServerReflectionRequest carrying a single oneof arm. Used by an in-process reflection client (and by the round-trip tests).

    health_check_path

    let health_check_path : String

    The gRPC HTTP/2 path of the Check method.

    health_watch_path

    let health_watch_path : String

    The gRPC HTTP/2 path of the Watch method.

    reflection_v1_path

    let reflection_v1_path : String

    The gRPC HTTP/2 path of the v1 reflection stream.

    reflection_v1alpha_path

    let reflection_v1alpha_path : String

    The gRPC HTTP/2 path of the legacy v1alpha reflection stream. grpcurl tries v1 first and falls back to this, so a server registers both.

    server_streaming

    A server-streaming handler over message types: each reply encoded in turn.

    unary

    A unary handler over message types: the request decoded, the reply encoded, an error raised by f answered with its status.