Commit Graph

7 Commits

Author SHA1 Message Date
Brummel a1ce14ccc7 plan: per-symbol geometry sidecar reader
Two-task plan for #3: (1) the meta module — InstrumentGeometry +
from_sidecar_bytes parser + serde_json dep + README update + unit tests;
(2) DataServer::symbol_meta + deterministic tempdir integration tests.

refs #3
2026-06-25 14:25:01 +02:00
Brummel 4bda01e627 spec: per-symbol geometry sidecar reader (boss-signed)
Settled prose design from #3: a reader returning neutral InstrumentGeometry
(digits, pip_size, tick_size, lot_size, base, quote) from <SYMBOL>.meta.json.
Signed autonomously under /boss on the grounding-check PASS; fork decisions
(base/quote pass-through, unknown-version -> None, serde_json, no caching)
are logged on the reference issue.

refs #3
2026-06-25 14:19:42 +02:00
Brummel 0f5e6655b9 Replace flaky concurrent-access test with deterministic equivalent
test_real_concurrent_access depended on /mnt data (skipped otherwise)
and asserted equal counts over a partial 10-chunk read, which thread
scheduling could make uneven. The SymbolGuard ownership model closes
the underlying races, so concurrent consumers reading the same symbol
to completion read an identical, fixed record set regardless of
scheduling.

Replace it with a self-contained inline test: eight threads each fully
drain a stream over temp files and must read identical counts. Runs
everywhere with no /mnt dependency; verified deterministic across 30
consecutive runs.
2026-06-04 17:51:14 +02:00
Brummel a31e26d3c1 Close stream setup races with SymbolGuard ownership model
stream_*_windowed loaded the first file and spawned a prefetch before
retaining the symbol, leaving loaded files at refcount 0 in a window
where a concurrent release could evict them (redundant reload), and a
prefetch thread could insert after an evict, leaving a refcount-0
orphan (leak).

Introduce a SymbolGuard RAII type: creating it retains the symbol,
dropping it releases. ensure_*_loaded now takes &SymbolGuard, making
"retain before load" a compile-time precondition that closes the
reload race structurally. prefetch_* clones a guard synchronously
before spawning and holds it across the insert, so the refcount
cannot reach zero between load and insert, closing the orphan leak.

Add an always-on load counter (DataServer::files_loaded) and a
deterministic regression test asserting each file is read from disk
exactly once across prefetch and a second consumer, locking the
no-redundant-I/O performance contract the fix must not regress.

closes #1
2026-06-04 17:44:37 +02:00
Brummel 20c2ff1d47 Add integration test moved from myc
Real-tickdata integration test (skip-guarded on /mnt/tickdata) carved
out of the myc repo so the crate is self-testing on reuse. Paths
adjusted myc::ast::data_server:: -> data_server:: ; otherwise verbatim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 11:20:14 +02:00
Brummel eee94a37ca Replace README with interface documentation
Concise API reference for the public surface (entry points, DataServer
query/stream methods, SymbolChunkIter, record types, lower-level modules)
plus a usage example, concurrency notes and the data-file naming convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 11:12:24 +02:00
Brummel c0b1268e14 Initial commit: data-server leaf crate extracted from myc
High-performance, thread-safe loader and cache for binary market data
files (M1/tick). No dependency on the rest of myc; only chrono, regex, zip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 11:01:58 +02:00