Skip to content

feat(server): add ObjectStorage trait + CompioFsStorage + InMemoryStorage#3226

Closed
jayakasadev wants to merge 3 commits into
apache:masterfrom
jayakasadev:pr3226
Closed

feat(server): add ObjectStorage trait + CompioFsStorage + InMemoryStorage#3226
jayakasadev wants to merge 3 commits into
apache:masterfrom
jayakasadev:pr3226

Conversation

@jayakasadev
Copy link
Copy Markdown

@jayakasadev jayakasadev commented May 8, 2026

Which issue does this PR close?

Part of #3228 — Phase 1a; umbrella stays open through Phase 10.

Rationale

Adds the `ObjectStorage` seam so phases 2+ can migrate persistence subsystems onto a non-fs backend without touching every call site. No-op for fs deployments.

What changed?

Persistence sites called `compio::fs` directly; there was no seam to plug a non-fs backend into.

A new `ObjectStorage` trait + two backends (`CompioFsStorage` passthrough, `cfg(test)` `InMemoryStorage`) live in `core/server/src/streaming/storage/object_store.rs`. A `[system.storage]` config block selects `kind = "fs"` (default) vs `"object"`; both resolve to fs since the S3 backend lands in #3227. The trait is `?Send` because compio's io_uring driver yields non-`Send` futures.

Local Execution

  • Passed: `cargo fmt --all -- --check`, `cargo clippy --workspace --no-deps --tests -- -D warnings`, `cargo test --workspace --lib` (11 new tests in `streaming::storage::object_store::tests`), `cargo build --workspace`, `cargo machete`, `cargo sort --workspace --check`.
  • Pre-commit hooks: `prek` not installed locally; the standalone checks above were run.

AI Usage

  1. Claude (Anthropic, Opus 4.7).
  2. Generated function — trait, both backends, config, tests drafted by the assistant; reviewed and edited locally for fit with iggy patterns (compio fs helpers, `err_trail`, `static_toml!`).
  3. Verified via `cargo test --workspace --lib` and the feasibility spike that informed feat(server): add S3Storage + BufferedMultipartWriter #3227.
  4. Yes.

…rage

Phase 1a of the S3-as-primary-storage milestone. Adds the abstraction seam
without bringing in rusty-s3/cyper deps. fs mode is unchanged; setting
[system.storage] kind = "object" warns and falls back to CompioFsStorage
until Phase 1b lands the real S3 backend.

What lands:
- core/server/src/streaming/storage/object_store.rs: ObjectStorage trait,
  MultipartHandle trait, CompioFsStorage, and a cfg(test) InMemoryStorage
  with 11 unit tests covering put/get/head/list/delete/multipart/CAS.
- [system.storage] config block (kind, object.{service,bucket,region,
  endpoint,prefix,multipart_part_size,ack_after_upload,credentials}).
- bootstrap::resolve_object_storage seam returning Rc<dyn ObjectStorage>.

The trait is `?Send` because compio's per-thread io_uring driver yields
non-Send futures; ObjectStorage instances are per-shard, not shared
across threads.
Phase 1b of the S3-as-primary-storage milestone. Adds the compio-native S3
backend behind cargo features = ["object-storage"] (default off). When the
feature is on and [system.storage] kind = "object", bootstrap returns an
S3Storage built on rusty-s3 (SigV4 + request shaping) and cyper (compio
HTTP client, rustls TLS) — no tokio, no opendal.

What lands:
- rusty-s3 + url added as optional deps under the `object-storage` feature.
  cyper and rustls were already in the server crate.
- S3Storage with all ObjectStorage methods (put/put_if_absent/put_multipart/
  get_range/head/list_prefix/delete) plus an S3Multipart handle.
- BufferedMultipartWriter that coalesces sub-5-MiB iggy flushes into S3-legal
  parts; the small-segment path aborts the multipart and falls back to a
  single PUT under threshold (a feasibility spike against real AWS S3
  confirmed S3 rejects parts < 5 MiB with EntityTooSmall otherwise).
- main.rs installs rustls::crypto::ring::default_provider() at boot when the
  feature is on (idempotent — `install_default` returns Err if already set).
- bootstrap::resolve_object_storage now returns S3Storage for kind = "object"
  + feature on; without the feature, logs a warning and returns fs.
- 5 new unit tests (4 on BufferedMultipartWriter, 1 IGGY_TEST_MINIO-gated
  S3 wire round-trip).
- core/server-ng/config.toml gets the matching [system.storage] block so its
  embedded-toml validation test still passes after the SystemConfig field add.

Two correctness findings from a pre-merge AWS S3 spike that this commit
bakes in:
- AWS ETags arrive wrapped in quotes (`"abc"`); rusty-s3's
  CompleteMultipartUpload re-wraps them, so callers must `.trim_matches('"')`
  before passing the etag back. S3Multipart::upload_part does this.
- Multipart minimum part size is 5 MiB except the final part. The
  BufferedMultipartWriter `part_size` argument is debug-asserted >= that.

Stacks on Phase 1a.
feat(server): add S3Storage + BufferedMultipartWriter
@hubcio hubcio closed this May 9, 2026
@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented May 9, 2026

See the reason for closure in #3228.

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.

2 participants