Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8d81934
Feat(backend, pipeline):
Nov 24, 2026
9564042
Feat(backend, pipeline): added missing lines.
Nov 24, 2026
58ae654
Merge branch 'backend/websocket' into backend/pipeline
GaziH Dec 1, 2026
8e8a76d
Merge branch 'refs/heads/backend/event' into backend/pipeline
GaziH Dec 1, 2026
da342fd
Feat(backend, pipeline): move pipeline to station and publish WS payl…
GaziH Dec 1, 2026
4b67a0d
Feat(backend, pipeline): Refactored pipeline to be split up in simili…
GaziH Dec 1, 2026
33d7fbd
Feat(backend, pipeline): Made in line comments where necessary.
GaziH Dec 1, 2026
192cd8d
Feat(backend, pipeline): Added management of frontend connection. Mor…
GaziH Dec 3, 2026
b0e8847
Feat(backend, pipeline): Added /heartbeat management.
GaziH Dec 3, 2026
0099c45
Feat(backend, pipeline): Added board connection tracking
Dec 3, 2026
4970360
Feat(backend, pipeline): Fixed rust formatting with rustfmt
GaziH Dec 4, 2026
b675ae8
Feat(backend, pipeline): Updated ReadMe
GaziH Dec 4, 2026
f8a62c8
Merge branch 'new-backend' into backend/pipeline
JavierRibaldelRio Dec 5, 2026
799f135
Feat(backend, pipeline): Fixed merging conflicts
Dec 5, 2026
9e7e13a
Feat(backend, pipeline): Upload of test used.
Dec 5, 2026
e454739
Feat(backend, pipeline): Added pipeline saturation management.
Dec 5, 2026
a882516
Merge branch 'new-backend' into backend/pipeline
JavierRibaldelRio Dec 5, 2026
ac9b5cd
fix
JavierRibaldelRio Dec 5, 2026
c2facbd
fix(backend, pipeline): remove saturation status
JavierRibaldelRio Dec 5, 2026
73da6d0
docs(backend, pipeline): pipeline exists; main still uses stand-ins
JavierRibaldelRio Dec 6, 2026
86d2221
test(backend, pipeline): snapshot, connections, broker closed, accumu…
JavierRibaldelRio Dec 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions backend/crates/station/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ El backend de la Control Station de Hyperloop UPV: escucha a las placas del
pod, decodifica sus paquetes, los reenvía a los frontends y guarda un
registro en disco. Construido sobre [`software-core`](../core/README.md).

La librería ([`lib.rs`](src/lib.rs)) expone los módulos [HTTP](src/http/README.md)
y [WebSocket](src/websocket/README.md) como `station::http` y
`station::websocket`.
La librería ([`lib.rs`](src/lib.rs)) expone los módulos de station:

- [`event`](src/event/README.md): la comunicación entre los módulos.
- [`pipeline`](src/pipeline/README.md): convierte lo que reparte `event` en lo
que muestra el front.
- [`payload`](src/payload/README.md): los mensajes que viajan por el
WebSocket.
- [`websocket`](src/websocket/README.md): el broker y las conexiones con los
frontends.
- [`http`](src/http/README.md): la API HTTP (catálogos del ADJ y el upgrade a
WebSocket).

## Ejecutar la demo

```sh
cargo run -p station -- "Hyperloop UPV"
cargo run -p station --release
```

El binario ([`main.rs`](src/main.rs)) ejecuta la [demo de saludo](../../readme-demo.md).
El arranque del backend y la carga de la configuración quedan pendientes.

El binario ([`main.rs`](src/main.rs)) descarga el ADJ, escucha en el puerto
UDP y pasa lo que llega por `event` a dos sustitutos de `logging` y
`pipeline`. Ver [`../../readme-demo.md`](../../readme-demo.md). El arranque
completo del backend (TCP, WebSocket y HTTP) y la carga de la configuración
quedan pendientes.
35 changes: 25 additions & 10 deletions backend/crates/station/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ pub struct EventConfig {
pub udp_queue: usize,
/// Slots in ⑤ (to `logging`).
pub logging_queue: usize,
/// Slots in ⑥ (to `pipeline`).
/// Slots in ⑥ (to `pipeline`: everything but telemetry). Little traffic,
/// and nothing on it may be lost: when it is full, the routing loop waits.
pub pipeline_queue: usize,
/// Slots in ⑨ (telemetry to `pipeline`). When it is full, the routing
/// loop drops the front's copy instead of waiting (`logging` still gets
/// it), so a slow front never slows down the backend.
pub pipeline_data_queue: usize,
/// Slots in ⑦ (orders from the front).
pub orders_queue: usize,
/// Send the fault a board sends to every other board as well.
Expand All @@ -98,7 +103,8 @@ impl Default for EventConfig {
tcp_queue: 1024,
udp_queue: 8192,
logging_queue: 8192,
pipeline_queue: 8192,
pipeline_queue: 1024,
pipeline_data_queue: 8192,
orders_queue: 32,
propagate_fault: true,
fault_timeout: Duration::from_secs(2),
Expand Down Expand Up @@ -166,11 +172,13 @@ pub enum ToLogging {
},
}

/// What `pipeline` receives (⑥).
/// What `pipeline` receives on ⑥: everything but telemetry, which goes on ⑨
/// ([`Channels::pipeline_data`]).
#[derive(Debug)]
pub enum ToPipeline {
/// A notification, TCP or UDP, as soon as it arrives. `logging` gets the
/// same copy.
/// A notification that is not a data packet (connected, disconnected, a
/// protection, a message), as soon as it arrives. `logging` gets the same
/// copy.
Received(Arc<Notification>),
/// Something the operator is told, shown on the front as a message from
/// the backend: as information, a warning or a fatal error, by its kind.
Expand Down Expand Up @@ -231,15 +239,19 @@ pub struct Channels {
pub notices: mpsc::Sender<Notice>,
/// ⑤, for `logging`.
pub logging: mpsc::Receiver<ToLogging>,
/// ⑥, for `pipeline`.
/// ⑥, for `pipeline`: everything but telemetry.
pub pipeline: mpsc::Receiver<ToPipeline>,
/// ⑨, for `pipeline`: telemetry only, every notification a
/// `Packet::Data`, the same copy `logging` gets. The routing loop drops
/// the front's copy when it is full.
pub pipeline_data: mpsc::Receiver<Arc<Notification>>,
}

/// `event`'s own ends of the queues: the reading side of ① ② ③ ④ ⑦ and the
/// writing side of ⑤ ⑥. Only [`spawn`] opens it.
/// writing side of ⑤ ⑥ ⑨. Only [`spawn`] opens it.
#[derive(Debug)]
pub struct EventEnds {
/// ① ② ③ ④ ⑤ ⑥: for the routing loop.
/// ① ② ③ ④ ⑤ ⑥ ⑨: for the routing loop.
router: RouterEnds,
/// ⑦: for the orders worker.
orders: mpsc::Receiver<OrderPacket>,
Expand All @@ -263,6 +275,7 @@ pub fn channels(config: &EventConfig) -> Channels {
let (orders_tx, orders_rx) = mpsc::channel(config.orders_queue.max(1));
let (logging_tx, logging_rx) = mpsc::channel(config.logging_queue.max(1));
let (pipeline_tx, pipeline_rx) = mpsc::channel(config.pipeline_queue.max(1));
let (pipeline_data_tx, pipeline_data_rx) = mpsc::channel(config.pipeline_data_queue.max(1));

Channels {
udp,
Expand All @@ -274,6 +287,7 @@ pub fn channels(config: &EventConfig) -> Channels {
notices: notices_rx,
logging: logging_tx,
pipeline: pipeline_tx,
pipeline_data: pipeline_data_tx,
tcp_capacity,
udp_capacity,
},
Expand All @@ -283,6 +297,7 @@ pub fn channels(config: &EventConfig) -> Channels {
notices: notices_tx,
logging: logging_rx,
pipeline: pipeline_rx,
pipeline_data: pipeline_data_rx,
}
}

Expand All @@ -296,7 +311,7 @@ pub fn channels(config: &EventConfig) -> Channels {
/// available" and the fault is only traced.
///
/// The returned task ends with the reason it stopped, once the workers have
/// been stopped too: by then every sender of ⑤ and ⑥ is gone, so `logging`
/// been stopped too: by then every sender of ⑤ ⑥ ⑨ is gone, so `logging`
/// and `pipeline` finish what they have queued and end on their own.
pub fn spawn(
config: EventConfig,
Expand Down Expand Up @@ -354,7 +369,7 @@ async fn run(
let router = Router::new(config, pod_data, index, ends, fault_tx);

// Runs until it has to stop. It takes the router by value, so its ends of
// ⑤ ⑥ ⑧ are dropped when it returns.
// ⑤ ⑥ ⑧ ⑨ are dropped when it returns (⑨ has no other sender).
let stop = router.route().await;

// The workers would never end on their own (⑦ and ⑧ stay open), and their
Expand Down
Loading
Loading