Skip to content

Pluggable index storage for build-while-reading - #1

Merged
vsazhenyuk-softheme merged 6 commits into
mainfrom
feat/flexible-storage-for-indexes-windows
Jun 11, 2026
Merged

Pluggable index storage for build-while-reading#1
vsazhenyuk-softheme merged 6 commits into
mainfrom
feat/flexible-storage-for-indexes-windows

Conversation

@vsazhenyuk-softheme

@vsazhenyuk-softheme vsazhenyuk-softheme commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

The index could only be persisted to a single seekable file, and the access-point table was written only on finish(). That made it impossible to use an index while it was still being built — a separate decoder had nothing to
read until the builder completed — and it hard-wired the index layout to a local file, ruling out other backends or concurrent readers.

Solution

Introduced an IndexStorage trait that abstracts where access points and their 32 KB windows live, alongside new store-backed types (GzStoreIndexBuilder / GzStoreDecoder, plus Deflate* / Zlib* variants). The
decompression core was extracted into a shared Engine, so the existing file-based path is reused verbatim and its on-disk format is unchanged.

This enables:

  • Read while building — each access point is handed to append as it's produced, so a decoder sharing the store can seek immediately, with no finish() required.
  • Any backend — windows/points can live in a DB, object store, shared memory, etc.
  • Concurrency — all trait methods take &self, so one cloneable handle feeds a builder and a decoder on different threads.

Window encoding is selectable via WindowFormat (Raw or Deflate) and is self-describing on read. Backend errors surface through a new Error::Callback variant.

@vsazhenyuk-softheme vsazhenyuk-softheme changed the title Flexible storage for indexes and windows data Pluggable index storage for build-while-reading Jun 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a pluggable-storage variant of the index builder/decoder so access points + 32KB windows can be persisted in arbitrary backends (and consumed concurrently while the index is still being built), reusing the same decompression/seek core as the file-backed implementation.

Changes:

  • Introduces IndexStorage, Window/WindowFormat, and store-backed *StoreIndexBuilder / *StoreDecoder public APIs.
  • Refactors the shared decompression/seek logic into a storage-agnostic Engine + SeekPoint layer used by both file-backed and store-backed paths.
  • Adds integration tests for store-backed indexing/decoding and strengthens CI (fmt/clippy/rustdoc warnings as errors) plus a manual release workflow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/store.rs Implements the store-backed builder/decoder and the IndexStorage contract.
src/base.rs Refactors shared decompression/seek code into Engine/SeekPoint and adapts file-backed types.
src/lib.rs Exposes the new store-backed public API surface via a macro-generated interface.
tests/store.rs Adds integration tests covering store-backed indexing, concurrent read-while-build, and tar.gz random access.
README.md Documents the new pluggable storage API and usage.
.github/workflows/rust.yml Expands CI to include fmt/clippy/docs checks.
.github/workflows/release.yml Adds a manually-invoked release workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
Comment thread src/base.rs
Comment thread src/base.rs Outdated
Comment thread src/store.rs
Comment thread src/base.rs
Comment thread src/store.rs
Comment thread README.md
Comment thread .github/workflows/rust.yml
@vsazhenyuk-softheme
vsazhenyuk-softheme merged commit 450d7a9 into main Jun 11, 2026
1 check passed
@vsazhenyuk-softheme
vsazhenyuk-softheme deleted the feat/flexible-storage-for-indexes-windows branch June 11, 2026 10:40
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