# dcajacob/ssync architecture

> Architecture diagram of the GitHub repository dcajacob/ssync, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dcajacob/ssync
- Repository: https://github.com/dcajacob/ssync

## Overview

Space Sync is an experimental, bidirectional UDP file-transfer system for intermittent links. Users run a node at each end, open a pass, and use the client to list, fetch, prioritize, send, take, or delete peer files. Nodes exchange protocol frames; receivers persist and verify incoming chunks, while senders pace transmissions and repair missing ranges when feedback is available. The README also describes restart recovery, optional packet FEC, a terminal monitor, and a simulated-link lab. Edges reflect README statements and source-index references; unsampled implementations are represented cautiously.

Main entry points: [`src/ssync/space_sync/node_control.py`](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/node_control.py) (Node control), [`src/ssync/space_sync/receiver.py`](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/receiver.py) (Receiver), [`src/ssync/space_sync/endpoint.py`](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/endpoint.py) (UDP endpoint), [`src/ssync/space_sync/lab.py`](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab.py) (Lab supervisor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_client["File client<br/>[client_cli.py]"]
  node_monitor["Terminal monitor<br/>[monitor.py]"]
  node_cli["Command entry<br/>[cli.py]"]
end

subgraph group_node["Node control"]
  node_daemon["Node daemon<br/>[daemon_cli.py]"]
  node_control["Node control<br/>[node_control.py]"]
  node_requests["Peer requests<br/>[node_requests.py]"]
  node_endpoint["UDP endpoint<br/>[endpoint.py]"]
end

subgraph group_transfer["Transfer protocol"]
  node_sender["Sender<br/>[sender.py]"]
  node_session["Sender session<br/>[sender_session.py]"]
  node_receiver["Receiver<br/>[receiver.py]"]
  node_frames["Wire frames<br/>[frames.py]"]
  node_fec["Packet FEC<br/>[fec.py]"]
  node_pacing["Rate pacing<br/>[pacing.py]"]
end

subgraph group_state["Transfer state"]
  node_manifest["Transfer manifest<br/>[manifest.py]"]
  node_ranges["Chunk ranges<br/>[ranges.py]"]
  node_storage[("Receiver storage<br/>[storage.py]")]
  node_output["Output directories<br/>[output_dir.py]"]
end

subgraph group_lab["Link lab"]
  node_lab["Lab supervisor<br/>[lab.py]"]
  node_labapp["Lab dashboard<br/>[lab_app.py]"]
  node_lablink["Link emulator<br/>[lab_link.py]"]
  node_labpace["Lab pacing<br/>[lab_pacing.py]"]
  node_labpayload["Lab payloads<br/>[lab_payloads.py]"]
end

node_operator(("Operator"))
node_peer(("Remote node"))

node_operator -->|"runs commands"| node_cli
node_cli -.->|"dispatches client"| node_client
node_cli -.->|"dispatches daemon"| node_daemon
node_operator -->|"watches transfers"| node_monitor
node_operator -->|"opens pass"| node_daemon
node_client -->|"requests actions"| node_control
node_client -->|"issues peer requests"| node_requests
node_monitor -->|"browses peer"| node_requests
node_daemon -.->|"starts endpoint"| node_endpoint
node_control -->|"handles requests"| node_requests
node_control -->|"manages node"| node_endpoint
node_endpoint -->|"routes incoming"| node_receiver
node_endpoint -->|"routes feedback"| node_session
node_endpoint -->|"exchanges UDP"| node_peer
node_session -->|"schedules sends"| node_sender
node_sender -->|"encodes packets"| node_frames
node_sender -->|"uses pacing"| node_pacing
node_sender -->|"adds parity"| node_fec
node_receiver -.->|"decodes packets"| node_frames
node_receiver -->|"persists payloads"| node_storage
node_receiver -->|"tracks missing chunks"| node_ranges
node_receiver -->|"recovers chunks"| node_fec
node_frames -->|"encodes manifest"| node_manifest
node_frames -->|"encodes ranges"| node_ranges
node_control -->|"uses state"| node_storage
node_control -->|"manages directories"| node_output
node_operator -->|"runs simulation"| node_lab
node_labapp -->|"controls trials"| node_lab
node_lab -->|"configures link"| node_lablink
node_lab -->|"uses pacing"| node_labpace
node_lab -->|"loads payloads"| node_labpayload

click node_client "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/client_cli.py"
click node_monitor "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/monitor.py"
click node_cli "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/cli.py"
click node_daemon "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/daemon_cli.py"
click node_control "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/node_control.py"
click node_requests "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/node_requests.py"
click node_endpoint "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/endpoint.py"
click node_sender "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/sender.py"
click node_session "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/sender_session.py"
click node_receiver "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/receiver.py"
click node_frames "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/frames.py"
click node_fec "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/fec.py"
click node_pacing "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/pacing.py"
click node_manifest "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/manifest.py"
click node_ranges "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/ranges.py"
click node_storage "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/storage.py"
click node_output "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/output_dir.py"
click node_lab "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab.py"
click node_labapp "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_app.py"
click node_lablink "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_link.py"
click node_labpace "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_pacing.py"
click node_labpayload "https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_payloads.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_monitor,node_cli toneBlue
class node_daemon,node_control,node_requests,node_endpoint toneAmber
class node_sender,node_session,node_receiver,node_frames,node_fec,node_pacing toneMint
class node_manifest,node_ranges,node_storage,node_output toneRose
class node_lab,node_labapp,node_lablink,node_labpace,node_labpayload,node_operator,node_peer toneIndigo
```

## Components

### User interfaces

- [File client](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/client_cli.py): `src/ssync/space_sync/client_cli.py`
- [Terminal monitor](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/monitor.py): `src/ssync/space_sync/monitor.py`
- [Command entry](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/cli.py): `src/ssync/space_sync/cli.py`

### Node control

- [Node daemon](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/daemon_cli.py): `src/ssync/space_sync/daemon_cli.py`
- [Node control](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/node_control.py): `src/ssync/space_sync/node_control.py`
- [Peer requests](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/node_requests.py): `src/ssync/space_sync/node_requests.py`
- [UDP endpoint](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/endpoint.py): `src/ssync/space_sync/endpoint.py`

### Transfer protocol

- [Sender](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/sender.py): `src/ssync/space_sync/sender.py`
- [Sender session](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/sender_session.py): `src/ssync/space_sync/sender_session.py`
- [Receiver](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/receiver.py): `src/ssync/space_sync/receiver.py`
- [Wire frames](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/frames.py): `src/ssync/space_sync/frames.py`
- [Packet FEC](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/fec.py): `src/ssync/space_sync/fec.py`
- [Rate pacing](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/pacing.py): `src/ssync/space_sync/pacing.py`

### Transfer state

- [Transfer manifest](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/manifest.py): `src/ssync/space_sync/manifest.py`
- [Chunk ranges](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/ranges.py): `src/ssync/space_sync/ranges.py`
- [Receiver storage](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/storage.py): `src/ssync/space_sync/storage.py`
- [Output directories](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/output_dir.py): `src/ssync/space_sync/output_dir.py`

### Link lab

- [Lab supervisor](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab.py): `src/ssync/space_sync/lab.py`
- [Lab dashboard](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_app.py): `src/ssync/space_sync/lab_app.py`
- [Link emulator](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_link.py): `src/ssync/space_sync/lab_link.py`
- [Lab pacing](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_pacing.py): `src/ssync/space_sync/lab_pacing.py`
- [Lab payloads](https://github.com/dcajacob/ssync/blob/master/src/ssync/space_sync/lab_payloads.py): `src/ssync/space_sync/lab_payloads.py`

### Other components

- **Operator**
- **Remote node**

## Connections

- Operator → Command entry: runs commands (evidence: `README.md`)
- Command entry → File client: dispatches client
- Command entry → Node daemon: dispatches daemon
- Operator → Terminal monitor: watches transfers (evidence: `README.md`)
- Operator → Node daemon: opens pass (evidence: `README.md`)
- File client → Node control: requests actions (evidence: `src/ssync/space_sync/client_cli.py`)
- File client → Peer requests: issues peer requests (evidence: `src/ssync/space_sync/client_cli.py`)
- Terminal monitor → Peer requests: browses peer (evidence: `src/ssync/space_sync/monitor.py`)
- Node daemon → UDP endpoint: starts endpoint
- Node control → Peer requests: handles requests (evidence: `src/ssync/space_sync/node_control.py`)
- Node control → UDP endpoint: manages node (evidence: `src/ssync/space_sync/node_control.py`)
- UDP endpoint → Receiver: routes incoming (evidence: `src/ssync/space_sync/endpoint.py`)
- UDP endpoint → Sender session: routes feedback (evidence: `src/ssync/space_sync/endpoint.py`)
- UDP endpoint → Remote node: exchanges UDP (evidence: `README.md`)
- Sender session → Sender: schedules sends (evidence: `src/ssync/space_sync/sender_session.py`)
- Sender → Wire frames: encodes packets (evidence: `src/ssync/space_sync/sender.py`)
- Sender → Rate pacing: uses pacing (evidence: `src/ssync/space_sync/sender.py`)
- Sender → Packet FEC: adds parity (evidence: `src/ssync/space_sync/sender.py`)
- Receiver → Wire frames: decodes packets (evidence: `src/ssync/space_sync/receiver.py`)
- Receiver → Receiver storage: persists payloads (evidence: `src/ssync/space_sync/receiver.py`)
- Receiver → Chunk ranges: tracks missing chunks (evidence: `src/ssync/space_sync/receiver.py`)
- Receiver → Packet FEC: recovers chunks (evidence: `src/ssync/space_sync/receiver.py`)
- Wire frames → Transfer manifest: encodes manifest (evidence: `src/ssync/space_sync/frames.py`)
- Wire frames → Chunk ranges: encodes ranges (evidence: `src/ssync/space_sync/frames.py`)
- Node control → Receiver storage: uses state (evidence: `src/ssync/space_sync/node_control.py`)
- Node control → Output directories: manages directories (evidence: `src/ssync/space_sync/node_control.py`)
- Operator → Lab supervisor: runs simulation (evidence: `README.md`)
- Lab dashboard → Lab supervisor: controls trials (evidence: `src/ssync/space_sync/lab_app.py`)
- Lab supervisor → Link emulator: configures link (evidence: `src/ssync/space_sync/lab.py`)
- Lab supervisor → Lab pacing: uses pacing (evidence: `src/ssync/space_sync/lab.py`)
- Lab supervisor → Lab payloads: loads payloads (evidence: `src/ssync/space_sync/lab.py`)
