Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Building an application

How to write one. Types, signatures and code appear throughout, and the generated API documentation carries the detail this chapter leaves out.

Running the arena needs nothing but a Mumble client and comes first for that reason. Anatomy of an application is the shortest path to understanding what the demonstration is made of.

The pages after those two follow the order the work itself takes: rendering a view, deciding where a distinction belongs, declaring who hears whom, answering what clients do, moving connections between shards, and measuring the result.

Terms used here without definition are defined in The model.

The example to read

Every code fragment in this chapter is drawn from the demonstration application, which lives under tools/mumble-server-runtime-arena/ and builds with the workspace.

filewhat to take from it
src/main.rscomposition: gateway, two shards, an external update task
src/lobby.rsthe simplest shard that can exist, and a migration request
src/arena.rsscopes, overlays and the audio relation, one purpose each
src/router.rswhere an arrival goes, and what a credential buys
src/directory.rsstate shared between shards, and shard discovery
tests/arena.rsdriving a shard turn by turn without sockets

About 1200 lines of application code and 700 of tests, and the only crate in the repository naming both the runtime and a concrete business. Copying its shape is a reasonable way to start.