Skip to content

feat: readBlobRange — byte-range reads for O(1) point lookups#12

Merged
mbocevski merged 2 commits into
mainfrom
feat/read-blob-range
Apr 11, 2026
Merged

feat: readBlobRange — byte-range reads for O(1) point lookups#12
mbocevski merged 2 commits into
mainfrom
feat/read-blob-range

Conversation

@mbocevski

Copy link
Copy Markdown
Contributor

Summary

  • readBlobRange(path, offset, length) — new method on StorageBackend for byte-range reads. FsBackend uses fs.read with file offset for true O(1) seek.
  • Enables JSONL record stores where each record is read by seeking to its byte offset without parsing the full file.

Breaking

  • StorageBackend interface has 1 new required method. Custom backends must implement readBlobRange.

…nt lookups

FsBackend uses fs.read with file offset for true seek. Enables JSONL
record stores where each record is read by seeking to its byte offset
without parsing the full file.

5 new tests: start/middle/end of file, exact length, JSONL pattern.
- Validate offset/length non-negative, throw on negative values
- Return only bytesRead bytes (not zero-padded buffer) when length exceeds file
- Zero-length returns empty buffer immediately (no file I/O)
- 4 new edge case tests: oversized length, zero length, offset at EOF, negative values
@mbocevski mbocevski merged commit 8eeaf7a into main Apr 11, 2026
3 checks passed
@mbocevski mbocevski deleted the feat/read-blob-range branch April 11, 2026 15:28
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