feat: add run deletion, session reopen, and feed merging (v0.6.0)
- DELETE /api/sessions/{id}/runs/{run_id} removes stopped runs
- POST /api/sessions/{id}/reopen transitions Completed → Active
- Optional merge_feeds field on POST /api/sessions/{id}/runs combines
frames from multiple feeds with priority-based deduplication
- In-place merge_frames() avoids 2× peak memory
- All new fields use #[serde(default)] for backward compatibility
- Updated README.md with new endpoints and feed merging docs
This commit is contained in:
parent
e3aa511ac7
commit
9fae8ba9d8
5 changed files with 208 additions and 11 deletions
48
README.md
48
README.md
|
|
@ -100,7 +100,7 @@ The terminal UI shows one panel per active feed:
|
|||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────┐
|
||||
│ rusty-telemetry v0.5.0 -- Telemetry Listener │
|
||||
│ rusty-telemetry v0.6.0 -- Telemetry Listener │
|
||||
├──────────────────────────────────────────────────────────┤
|
||||
│ ╔ * Receiving ╗ │
|
||||
│ ║ 20.0 Hz 1200 packets 15.2 KB/s last: 0.05s ║
|
||||
|
|
@ -151,9 +151,32 @@ Use-case sessions allow targeted data capture and analysis:
|
|||
2. **Start runs** — each run captures frames from the ring buffer between start and stop
|
||||
3. **Complete the session** — auto-analyzes captured data and stores results
|
||||
4. **Retrieve analysis** — shift point RPM ranges or track boundary coordinates
|
||||
5. **Re-open if needed** — re-open a completed session to add more runs, then complete again
|
||||
6. **Delete runs** — remove unwanted runs from a session (must be stopped first)
|
||||
|
||||
Sessions are in-memory and independent of persistent recordings.
|
||||
|
||||
#### Feed Merging
|
||||
|
||||
When multiple feeds are available during a recording (e.g., both KSUDP on port 9996 and Telemetry Tool on port 10101), runs can merge frames from multiple sources for more accurate analysis data.
|
||||
|
||||
To start a merged run, specify `merge_feeds` in the start run request:
|
||||
|
||||
```json
|
||||
{
|
||||
"feed_name": "ksudp",
|
||||
"merge_feeds": ["telemetry_tool"]
|
||||
}
|
||||
```
|
||||
|
||||
The merge algorithm:
|
||||
1. Extracts frames independently from each feed using ring buffer markers
|
||||
2. Sorts all frames by `(lap_count, lap_time_ms)`
|
||||
3. Deduplicates near-simultaneous frames (within 15ms) by keeping the higher-priority feed
|
||||
4. Feed priority: Telemetry Tool > KSUDP > PCARS
|
||||
|
||||
This results in higher effective data density (combining 60 Hz TT + 20 Hz KSUDP) while preferring the richer Telemetry Tool data where available.
|
||||
|
||||
## REST API
|
||||
|
||||
A built-in HTTP API server runs on port 8080 for recording management and live telemetry access.
|
||||
|
|
@ -178,6 +201,8 @@ A built-in HTTP API server runs on port 8080 for recording management and live t
|
|||
| DELETE | `/api/sessions/{id}` | Delete session |
|
||||
| POST | `/api/sessions/{id}/runs` | Start a run |
|
||||
| POST | `/api/sessions/{id}/runs/{run_id}/stop` | Stop a run |
|
||||
| DELETE | `/api/sessions/{id}/runs/{run_id}` | Delete a stopped run from session |
|
||||
| POST | `/api/sessions/{id}/reopen` | Re-open a completed session |
|
||||
| POST | `/api/sessions/{id}/complete` | Complete session + auto-analyze |
|
||||
| GET | `/api/sessions/{id}/analysis` | Get analysis results |
|
||||
| POST | `/api/sessions/{id}/analyze` | Re-run analysis on completed session |
|
||||
|
|
@ -236,10 +261,29 @@ All fields are optional.
|
|||
```json
|
||||
{
|
||||
"feed_name": "ksudp",
|
||||
"label": "Acceleration runs"
|
||||
"label": "Acceleration runs",
|
||||
"merge_feeds": ["telemetry_tool"]
|
||||
}
|
||||
```
|
||||
|
||||
`merge_feeds` is optional. When specified, frames from the listed feeds are merged with the primary feed's frames into a single deduplicated dataset. This is useful for combining the higher-frequency Telemetry Tool data (~60 Hz) with KSUDP data (~20 Hz) for more accurate analysis.
|
||||
|
||||
### Delete Run
|
||||
|
||||
Deletes a stopped run from a session. If the session was completed and had analysis results, the analysis is cleared (since the underlying data changed). Re-run analysis after deletion if needed.
|
||||
|
||||
Returns `204 No Content` on success. Cannot delete a run that is currently recording — stop it first.
|
||||
|
||||
### Reopen Session
|
||||
|
||||
Re-opens a completed session, changing its status back to active. This clears the `completed_at` timestamp and any analysis results, allowing new runs to be added. Complete the session again when done to re-run analysis.
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
Returns the updated session on success.
|
||||
|
||||
### Use Cases Response
|
||||
|
||||
```json
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue