Skip to content

Harden storage&cleanup, set up portable dist. - #2

Merged
akenshaw merged 8 commits into
masterfrom
extend-cleanup
Jul 18, 2026
Merged

Harden storage&cleanup, set up portable dist.#2
akenshaw merged 8 commits into
masterfrom
extend-cleanup

Conversation

@akenshaw

Copy link
Copy Markdown
Member

This PR started as an extension of the data cleanup subsystem but grew into a broader set of improvements across storage, config, documentation, and release automation.

Highlights

Cleanup & storage hardening

  • Adds max_storage_mb — a hard cap on DuckDB file size (default 4 GiB).
  • When exceeded, oldest trades are purged even if within the time-based retention window.
  • Validates retention hours at startup, retries VACUUM on failure, and fixes an off-by-one in the purge delay.
  • Separates initial cleanup pass from the periodic scheduler so startup is faster.
  • Introduces headroom fraction to prevent hitting the cap during a flush.

Domain-typed config

  • Replaces raw String/u64 values with newtypes:
    • BearerToken
    • RetentionHours
    • StorageBytes
  • Makes the config self-documenting and harder to misuse.

Portable binary & distribution

  • Config file now defaults to next to the binary (not CWD), so the whole app lives in one folder.
  • Pass --config to override.
  • data_dir relative paths are resolved from the config file's parent directory — everything stays self-contained.
  • First-run template generation writes config.toml next to the binary; re-run to start.
  • Release automation with cargo-dist release.yml:
    • Builds for Linux (x86 + ARM), macOS (Intel + Silicon), and Windows.
    • Archives include the binary, README.md, LICENSE, and config.example.toml.
    • Triggered by pushing a tag like v0.1.0.

Documentation overhaul

  • Added full documented sections for:
    • GET /status
    • GET /pairs
    • GET /trades
    • GET /trades.arrow
    • GET /exchanges
  • Includes real response examples.
  • Cleaned up config template comments — relative paths now note they resolve from config directory.

@akenshaw
akenshaw merged commit 64167f1 into master Jul 18, 2026
1 check passed
@akenshaw
akenshaw deleted the extend-cleanup branch July 18, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant