Skip to main content

Module client

Module client 

Source
Expand description

The one connection every client verb shares: CLI → coordinator.

  astrs list / stop / logs -f / param … ─┐
                                         ▼
           TcpStream ─► FramedDuplex ─► initiate(Hello{role=Cli, token})
                                         │
           ControlRequest ───────────────┤  "stream 0"
           ControlReply   ◄──────────────┤
           Log / Data frames ◄───────────┘  pushed for a subscription

Blueprint §16 in one place: the greeting carries Role::Cli and the 64-hex cluster token, and a coordinator that refuses either says why in a typed astrs_wire::Refused the transport turns into an error this module reports with the address that was dialled attached — “connection refused” without an address is the least useful error a CLI can print.

§Why not astrs_transport::backend::connect

That entry point returns a astrs_transport::Connection — a route multiplexer with per-route streams, credit and datagrams, built for the daemon↔daemon data plane. A CLI has exactly one logical stream (§6.4’s “stream 0”) and needs the raw request/reply frames on it, which is what astrs_transport::FramedDuplex plus astrs_transport::initiate give directly. Using the mux here would add a header to every frame the coordinator’s CLI session does not speak.

Structs§

Client
One connected CLI session.
Endpoint
Everything needed to reach one coordinator.

Enums§

DataflowRef
Resolves a user-typed dataflow reference — an id or a name.

Constants§

HANDSHAKE_TIMEOUT
How long the greeting has before a dial is called dead.
REQUEST_TIMEOUT
How long a single request waits for its reply before giving up.

Functions§

default_port
The coordinator port this machine defaults to (§24.2).
endpoint
Builds the endpoint a client verb should dial from its flags.
new_subscription_id
Mints a subscription id no other client is likely to be using.
reply_name
The variant name of a reply, for CliError::UnexpectedReply.
resolve_addr
Resolves a --coordinator argument (or its absence) into an address.
resolve_text
The resolution rules resolve_addr documents, without the environment lookup — the part worth testing directly.
runtime
Builds a current-thread tokio runtime for one client verb.