Skip to main content

Module service_client

Module service_client 

Source
Expand description

The wrapper’s side of a commit through the commit service. What: The wrapper’s side of a commit through the resident service: connect, wait honestly while the operating system starts the service, send the request, show the queue position, survive a service that dies mid-request, and turn every failure into the plain text of service_messages.rs. Why: A failure the system can resolve is resolved here without the user: a service that is starting is waited for, one that crashed is reconnected to with the same request identity, one that is older than this wrapper is asked to retire and is reached again once the manager has started the new one. Only what cannot be resolved ends the command.

In TS you’d write (pseudocode):

const result = await submit(config, request, stderr); // landed, or prepare again, or a ClientFailure

Structs§

ClientConfig
What the client needs to reach the service.

Enums§

Activation
What the client may rely on the operating system to do.
Submitted
What a request came to.

Constants§

COMMIT_WAIT
How long a commit waits in the queue before the client gives up and says so.
RECONNECTS
How many times a request is sent again after the connection broke before the client says it cannot be sure.
REPLACEMENTS
How many times the client asks an older service to retire.
START_NOTICE_GRACE
How long a start takes before the client says it is starting the service.
START_WAIT
How long the client waits for the operating system to start the service.

Functions§

failure_for
The user-facing failure for a code the service gave.
submit
What: Sends a commit request and waits until it is answered. Why: The same identity goes with every send, so a service that landed the commit and died before answering reports it as already landed, and nothing lands twice.
wake
What: Tells the service that work items were written for a repository, starting it through the operating system when it is not running, and returns once the service has taken the message. Why: The wrapper never starts the service or runs the work itself; the message is the only thing the service needs to look at the repository’s work directory. The connection closes when the service has read the line, which is the confirmation that it will act.