Archived
Every live market is subscribed on two connections chosen at random, and its book takes each change from whichever connection delivers it first: the book hash says whether a change is a duplicate, the next one, or one to hold until the change before it arrives. A change one connection misses costs nothing, each Delta carries the earliest receive time, and a connection that drops is covered by the other. When a change fits on no connection in time, the book follows one connection unchecked and asks the other for a fresh book. Connections now decode and route events to 16 book threads, independent of them; a move leaves its old connection only once the new one delivers, so it costs no change; a connection closed with 1013 twice within ten minutes is split. reconcile reads the collector's log and fails only on a mismatch no cause line explains. SIGTERM and SIGHUP stop the collector cleanly. Breaking: lanes are gone (connections and book threads are separate), and reconcile takes the log as a second argument.
29 lines
949 B
TOML
29 lines
949 B
TOML
[package]
|
|
name = "engineering-challenge"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
build = "src/util/build.rs"
|
|
# `cargo run` runs the collector, not `src/bin/reconcile.rs`.
|
|
default-run = "engineering-challenge"
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
chrono = "0.4"
|
|
crossbeam = "0.8.4"
|
|
# `termination`: SIGTERM and SIGHUP stop the collector like SIGINT.
|
|
ctrlc = { version = "3", features = ["termination"] }
|
|
# Not used directly: tungstenite leaves rustls's crypto provider to the app, and
|
|
# rustls panics at runtime unless exactly one (here ring) is enabled.
|
|
rustls = { version = "0.23", default-features = false, features = ["ring"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
sha1 = "0.11"
|
|
tungstenite = { version = "0.30", features = ["rustls-tls-webpki-roots"] }
|
|
ureq = "3"
|
|
|
|
[build-dependencies]
|
|
ergo-sbe = "=0.1.16"
|
|
indexmap = { version = "2", features = ["serde"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_yaml_ng = "0.9"
|