Skip to content

Unreleased

Generated from the docstrings of Tau 0.16.0-dev (commit c439c401) by scripts/api_docs.py in the Tau repository. Not the 0.15 API.

The wire

tau serve and the remote client.

Names: Json, PROTOCOL, ProtocolError, ProtocolMismatch, Server, Welcome

Json

Json = dict[str, object]

A JSON object as Python holds it: what a schema or a decoded JSON object is typed as.

PROTOCOL

PROTOCOL: Final = 1

The wire protocol's version. D12: a version marks a released protocol. It goes up by one at a release whose docs/protocol.schema.json differs from the last tag's, never per commit.

ProtocolError

class ProtocolError(RuntimeError)

The other end broke the protocol: a message that is not JSON-RPC, a method that does not exist, a value that does not fit. Not a ConnectionError: connecting again would not help.

ProtocolMismatch

class ProtocolMismatch(ProtocolError)

hello named a protocol the server does not speak. server is the one it does.

ProtocolMismatch.init

def __init__(self, message: str, server: int) -> None

Server

class Server

A session's Driver served on a Unix socket (the module docstring). start binds path; welcome is what hello answers. wait returns when the driver has failed, or (with idle) when no client has been connected and every cursor at rest for that many seconds; close lets the connections say end (stop the driver first) and unbinds.

Server.init

def __init__(self, driver: Driver, path: Path, welcome: Welcome, idle: float | None = None) -> None

Server.start

@classmethod
async def start(
    cls,
    driver: Driver,
    path: Path,
    *,
    session: str,
    cwd: Path,
    idle: float | None = None,
) -> 'Server'

Serve driver (running, in the loop) at path, as session session in cwd. idle seconds is how long wait lets the server rest before it returns (None: never). OSError if the socket cannot be bound.

Server.wait

async def wait(self) -> Exception | None

Wait until the driver has failed (returns its failure) or stopped, or, for a server with idle, has rested that long (returns None).

Server.close

async def close(self) -> None

Let the connections finish (the driver should be stopped, so each has said end; one that has not in GRACE seconds is closed), then unbind. A call a connection began and left is cancelled.

Welcome

@dataclass(frozen=True)
class Welcome
    protocol: int
    version: str
    session: str
    cwd: str
    pid: int

What hello answers: the protocol the server speaks, its τ version, the session id it serves, the cwd that session runs in (paths complete there), and its pid.