Client Specification#
This specification states what a kRPC client library does on top of the messaging protocol. It covers the behavior a program sees, such as how a client reports a refused connection, matches responses to calls and delivers stream values.
The requirements are generated from the conformance tests. Each requirement has a test that checks it, and the text and the test are one source. A change to a requirement is a change to its test, so the two cannot drift apart. The tests run against the TestServer, a server that runs without the game.
This specification is versioned with kRPC. The conformance tests in the krpctools package of
a release check the specification of that release.
See also
Client Design covers how the kRPC clients are built, for ideas when designing your own.
Requirements#
Each requirement has an id of the form <area>-<name>, such as streams-wait. The area is one
page of this specification:
Area |
Covers |
|---|---|
Opening, reading and closing a connection |
|
Calling the members of a service, passing arguments, and matching responses to calls |
|
The values passed as arguments and read back as results |
|
Encoding and decoding values |
|
The errors reported for errors returned by the server |
|
The objects held for instances of a server’s classes |
|
Adding streams, reading their values and removing them |
|
Waiting on events and calling back on them |
|
Using one connection from several threads or async tasks |
|
Streaming, running and waiting on server side functions |
The conformance test for a requirement is named after it. The test for streams-wait is
test_wait in test_streams.py. The text of a requirement is the docstring of its test.
The results of the clients in this repository are listed under Client Coverage.
The key words MUST and SHOULD are used as described in RFC 2119. A requirement marked SHOULD holds unless a client has a reason recorded in its documentation.
Profiles#
Each requirement is listed with the profiles a client needs to run its test, then its level:
connection-serialio-leftovers [serialio] [MUST]
A requirement marked MUST holds in every client that implements its profiles. A requirement listed
without a profile applies only to the clients that do not implement it:
errors-message-prefix [core, without error-types] [MUST]
A client implements the core profile, and any of the others:
Profile |
Covers |
|---|---|
|
Connecting, calls, values, errors and objects |
|
Error types: a remote error type the client’s own errors derive, and a type for each exception a service lists |
|
Checking and converting arguments at run time, and calls a static type system rules out |
|
Building the services from the server’s definitions when connecting |
|
Generated enumerations and structures, used with no connection and shared where the server’s definitions match |
|
Omitting arguments that have defaults |
|
Passing arguments by name at run time |
|
Skipping an argument by position, so that it takes its default |
|
Adding streams, reading and waiting on their values, and removing them |
|
Calling back on stream updates, firings and stream ends |
|
Holding the condition of a stream or event to read and wait on it |
|
Events |
|
Streams, events and runs of server side functions |
|
Checking the type a program names for the value of a server side function |
|
Several connections open at once, sharing objects |
|
Calling a class’s static methods through the class bound to a connection, in a language where a class is a type |
|
Concurrent calls, waits, callbacks and closes, on threads or async tasks |
|
Ordering objects, in a language that orders values |
|
Forcing races between the update thread and the program, by pausing a thread of the client |
|