Skip to content

Add packfile library design doc#633

Open
tamirms wants to merge 3 commits intofeature/full-historyfrom
add-packfile-design-doc
Open

Add packfile library design doc#633
tamirms wants to merge 3 commits intofeature/full-historyfrom
add-packfile-design-doc

Conversation

@tamirms
Copy link
Contributor

@tamirms tamirms commented Mar 18, 2026

Summary

  • Adds a design document for a compact, immutable file format that provides O(1) random access to ordinal-indexed data (events, bitmaps, ledgers) with minimal I/O
  • This is a building block for a full history implementation of RPC (v2)
  • The doc covers the file format, read/write paths, integrity model, and API reference
  • The goal is to align on this design before proceeding with implementation — please flag any concerns or blockers so we can address them during the design stage

Note: This PR targets main for now but will be retargeted to the full history RPC / v2 branch once we align on that before merging.

Further reading

  • Reference implementation: packfile, intpack
  • Benchmarks — packfile vs RocksDB sstable across write throughput, sequential/random reads, compression efficiency, and bitmap indexing
  • Format comparison — technical evaluation of packfile vs RocksDB sstable across performance, code complexity, dependencies, and suitability for remote storage

🤖 Generated with Claude Code

Design document describing the packfile and intpack packages for
storing and reading large collections of immutable, ordinal-indexed
items (events, bitmaps, ledgers) with O(1) random access and minimal
I/O overhead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 18, 2026 17:56
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

Copilot AI left a comment

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 design document proposing a “packfile” immutable, ordinal-indexed file format and Go library API intended as a building block for Stellar RPC v2 full-history storage (compact storage with O(1) random access and minimal I/O).

Changes:

  • Introduces the packfile/intpack concepts, goals/non-goals, and usage examples.
  • Specifies the on-disk layout (records, index, trailer) plus integrity/content-hash model.
  • Documents proposed Go APIs for writer/reader, concurrency behavior, and error surface.

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

You can also share your feedback on Copilot code review. Take the survey.

- Clarify trailer flag descriptions: Bit 0 means not zstd-compressed
  (not implying CRC is always present), and document the Bit 0 + Bit 2
  combination as the Raw format
- Fix ErrIndexRange message from "record index" to "item index" to
  match the public API contract

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tamirms tamirms requested a review from a team March 18, 2026 18:08
@tamirms tamirms changed the base branch from main to feature/full-history March 19, 2026 13:12
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