Skip to main content

Crate pacenotes_shared

Crate pacenotes_shared 

Source
Expand description

Protocol types shared between the installer and the server.

Serde types only: no I/O, no async, no HTTP. Timestamps are unix seconds. Any change here is a protocol change and lands on both sides in one PR.

A package’s address is <data>/<game>/packages/<directory>/<name>.zip. directory decides who may see it (PUBLIC_DIR is everyone’s), and name is its path under that directory, which is also its place in the installer’s tree: codriver/polish/male/Kamil is category codriver, levels polish → male, leaf Kamil. Both stay lookup keys that are never joined onto a filesystem path.

Modules§

access 🔒
api_error 🔒
category 🔒
A category is the first segment of PackageInfo::name: the folder a package sits in under its access directory. The set is open; these are the known ones.
conflict_report 🔒
download_path 🔒
game 🔒
Game ids, as used in installer/DESIGN.md rev. 2 and installer/src/gamedir.rs. The set is open: a new game needs no protocol bump.
game_schema 🔒
key_status 🔒
lookup_key 🔒
manifest 🔒
package 🔒
package_ref 🔒

Structs§

ApiError
The body of every non-2xx response.
Conflict
One file several packages wrote.
ConflictReport
The body of POST /report/conflict: packages the user selected wrote the same file, and the later one won.
GameSchema
A game’s install schema as the manifest publishes it: which categories its catalogue has, which ask for one pick, and where each installs.
KeyStatus
The body of GET /whoami for a live access key; every other key is a 401, so the status alone tells a mistyped key from a good one, which /packages cannot, since it falls back to the public listing.
Manifest
The body of GET /packages.
PackageInfo
One installable package as listed by GET /packages.
PackageRef
A package’s directory/name: its download path, its cache and ledger key, and the wire form of a requires entry.
SchemaCategory
One [[category]] of a game’s schema.

Constants§

AUTH_HEADER
Carries the credential as Authorization: Bearer <token>.
BEARER_PREFIX
CATEGORY_CODRIVER
CATEGORY_LANGUAGE
CATEGORY_PACENOTES
CATEGORY_STYLE
CHOICE_CATEGORIES
The categories the Configuration scene asks for exactly one pick from, in display order.
GAME_ASSETTOCORSA
GAME_BEAMNG
GAME_DIRT_RALLY2
GAME_RBR
INSTALL_ROOT_GAME
SchemaCategory::install_root: the folder holding the game’s marker executable.
KNOWN_CATEGORIES
Lets the server spot a category name filed where an access directory belongs.
KNOWN_GAMES
Lets the server spot a game id filed where something else belongs.
PUBLIC_DIR
The access directory every caller may list and download, with or without a token.
SCHEMA_FILE
A game’s schema file on the server, <data>/<game>/schema.toml; the canonical copy is the repository’s schemas/<game>.toml.
SELECT_ANY
SchemaCategory::select: optional, installed as ticked.
SELECT_ONE
SchemaCategory::select: the user must pick exactly one.

Functions§

category_of_download_path
The first segment of the name in a game/directory/name.
default_game
The game of a package from a manifest written before games existed, which listed RBR only.
split_download_path
Takes a game/directory/name apart, the inverse of PackageInfo::download_path; only the first two / separate, since the name is itself a path. None unless every part is valid.
valid_id
Is this a usable game id or access directory name: [a-z0-9_-]+?
valid_name
Is this a usable PackageInfo::name: /-separated segments, none empty, none . or .., and no \ or control character anywhere?