feat: Template out rebuild#25
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR turns the crate back into a compilable library by introducing the core public API surface (traits, builder, registry, instance/viewer/types) and re-enabling CI workflows to run formatting, clippy, checks, and tests.
Changes:
- Added
SparseIOinstance +Builder, plus foundationalReader/Writer/Metadatatraits and supporting types. - Introduced a
ReaderRegistrywith unit tests and testing stubs forReader/Writer/Metadata. - Re-enabled GitHub Actions unit/quality workflows and updated architecture docs to match renamed APIs.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Defines crate module structure and exports; now serves as the main public surface. |
| src/instance.rs | Adds SparseIO coordinator and public entrypoints (builder, open). |
| src/builder.rs | Implements builder pattern for constructing SparseIO with validation + tests. |
| src/traits.rs | Introduces the core backend traits (Reader, Writer, Metadata). |
| src/types.rs | Adds ByteStream type used by Viewer. |
| src/viewer.rs | Adds Viewer read interface (currently stubbed). |
| src/registry.rs | Adds ReaderRegistry abstraction + unit tests. |
| src/utils/** | Adds test-only stubs for backends used in unit tests. |
| docs/architecture/*.md | Updates docs to match Builder and read_at/bytestream naming. |
| .github/workflows/*.yml | Enables CI steps for tests, clippy, fmt, and checks. |
| Cargo.toml | Adds dependencies used by the new API (bytes, parking_lot). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+12
| mod builder; | ||
| mod globals; | ||
| mod instance; | ||
| mod registry; | ||
| mod traits; | ||
| mod types; | ||
| mod utils; | ||
| mod viewer; | ||
|
|
||
| pub use instance::SparseIO; | ||
| pub use registry::ReaderRegistry; | ||
| pub use traits::{Metadata, Reader, Writer}; |
Comment on lines
+26
to
+35
| /// Create a builder for configuring a SparseIO instance. | ||
| pub fn builder() -> crate::builder::Builder { | ||
| crate::builder::Builder::new() | ||
| } | ||
|
|
||
| /// Open a canonical SparseIO path and return a viewer over the object. | ||
| pub fn open(&self, path: impl AsRef<str>) -> io::Result<Viewer> { | ||
| let _ = path; | ||
| todo!("resolve reader and create viewer") | ||
| } |
Comment on lines
+16
to
+31
| impl Viewer { | ||
| /// Alias for offset-based reads. | ||
| pub fn read_at(&self, _offset: usize, _length: usize) -> io::Result<Bytes> { | ||
| todo!("read bytes at offset from upstream object") | ||
| } | ||
|
|
||
| /// Return the total length of the upstream object. | ||
| pub fn len(&self) -> io::Result<usize> { | ||
| todo!("return upstream object length") | ||
| } | ||
|
|
||
| /// Convert this viewer into a chunked byte stream. | ||
| pub fn bytestream(&self) -> ByteStream { | ||
| todo!("convert viewer into a chunked byte stream") | ||
| } | ||
| } |
Comment on lines
+18
to
+27
| pub trait Writer: Send + Sync { | ||
| /// Write bytes into the cache under `key`. | ||
| fn write(&self, key: &str) -> io::Result<()>; | ||
|
|
||
| /// Read a byte range from the cache. | ||
| fn read(&self, key: &str) -> io::Result<Option<Bytes>>; | ||
|
|
||
| /// Delete all cached data associated with `key`. | ||
| fn delete(&self, key: &str) -> io::Result<()>; | ||
| } |
| use bytes::Bytes; | ||
|
|
||
| /// Stream type for chunked byte output from a viewer. | ||
| pub type ByteStream = Pin<Box<dyn Iterator<Item = io::Result<Bytes>> + Send>>; |
Comment on lines
+27
to
+29
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| shared-key: cargo-${{ inputs.runner }} |
Comment on lines
+25
to
+27
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| shared-key: cargo-${{ inputs.runner }} |
Comment on lines
+20
to
+21
| `chunk_size`. However these are explained a bit further in the | ||
| [`Builder` docs](http://docs.rs/sparseio/latest/sparseio/struct.Builder.html). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.