Skip to content

feat(store): add filesystem backends (DirectFile, JSONMutexDB, CAS)#824

Merged
Xe merged 4 commits intomasterfrom
filesystem-store
Jan 21, 2026
Merged

feat(store): add filesystem backends (DirectFile, JSONMutexDB, CAS)#824
Xe merged 4 commits intomasterfrom
filesystem-store

Conversation

@Xe
Copy link
Owner

@Xe Xe commented Jan 21, 2026

Summary

  • Add store package with a generic Interface for key-value storage operations
  • Implement three filesystem-based backends with different trade-offs:
    • DirectFile: Simple key→file mapping with nested directory support
    • JSONMutexDB: JSON index with mutex-protected concurrent access
    • CAS: Content-addressable storage with BoltDB index and deduplication

Changes

  • 11 files changed, 2024 insertions
  • New store package with:
    • store.go - Core Interface, Closer, and helpers
    • directfile.go - Direct key→file mapping backend
    • jsonmutex.go - JSON-based index backend
    • cas.go - Content-addressable storage backend
    • S3API backend (s3api.go)
    • Comprehensive test suites for each backend

Backend Details

DirectFile

  • Keys like "foo/bar/baz" create file at baseDir/foo/bar/baz
  • Validates keys to prevent path traversal
  • Uses filepath.WalkDir for prefix-based listing

JSONMutexDB

  • In-memory index persisted to index.json
  • Data files stored in data/ subdirectory
  • RWMutex for concurrent read safety
  • Suitable for small-medium datasets

CAS

  • Deduplicates data by SHA-256 hash
  • Objects sharded as objects/aa/bb/
  • BoltDB for key→hash mappings
  • Implements Closer for explicit cleanup

Test plan

  • Unit tests pass for DirectFile backend
  • Unit tests pass for JSONMutexDB backend
  • Unit tests pass for CAS backend
  • All backends implement the store Interface

Assisted-by: GLM 4.7 via Claude Code
Reviewbot-request: yes
Signed-off-by: Xe Iaso xe@tigrisdata.com

Xe added 4 commits January 21, 2026 12:25
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Add design document for three filesystem-based store backends:
- DirectFile: simple key→file mapping
- JSONMutexDB: JSON index with mutex locking
- CAS: content-addressable storage with BoltDB index

Assisted-by: GLM 4.7 via Claude Code
Reviewbot-request: yes
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Prepare for git worktree-based isolated development.

Assisted-by: GLM 4.7 via Claude Code
Reviewbot-request: yes
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Add three filesystem-based implementations of the store Interface:

- DirectFile: simple key→file mapping with nested directory support
  - Keys like "foo/bar/baz" create file at baseDir/foo/bar/baz
  - Validates keys to prevent path traversal (.. segments)
  - Uses filepath.WalkDir for prefix-based listing

- JSONMutexDB: JSON index with mutex-protected concurrent access
  - In-memory index persisted to index.json
  - Data files stored in data/ subdirectory
  - RWMutex for concurrent read safety
  - Suitable for small-medium datasets

- CAS: content-addressable storage with BoltDB index
  - Deduplicates data by SHA-256 hash
  - Objects sharded as objects/aa/bb/<hash>
  - BoltDB for key→hash mappings
  - Implements Closer for explicit cleanup

Also add Closer interface and Close() helper function for optional
cleanup of store backends.

Assisted-by: GLM 4.7 via Claude Code
Reviewbot-request: yes
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
@Xe Xe merged commit 4f694cf into master Jan 21, 2026
7 checks passed
@github-actions
Copy link
Contributor

The latest Buf updates on your PR. Results from workflow Go / build (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJan 21, 2026, 6:44 PM

Xe pushed a commit that referenced this pull request Feb 16, 2026
# [1.30.0](v1.29.0...v1.30.0) (2026-02-16)

### Bug Fixes

* **falin:** resolve npm ci dependency conflict ([#835](#835)) ([683bff8](683bff8))
* **mi:** use blog post summary in Bluesky embed description ([#848](#848)) ([7491810](7491810))
* **nguh:** return error for unsupported tokens ([d1a50e7](d1a50e7))
* **skills/xe-writing-style:** update details about successive paragraph starting letter rule ([5808b2b](5808b2b))
* **skills/xe-writing-style:** wumbofy this with Opus ([cea6609](cea6609))
* **useragent:** use filepath.Base for os.Args[0] in GenUserAgent ([#830](#830)) ([3ef21d9](3ef21d9))
* **web:** replace deprecated io/ioutil with io ([#829](#829)) ([fee5e4f](fee5e4f))

### Features

* **cmd/x:** add ai-add-provider and ai-list-models subcommands ([#850](#850)) ([bba7f41](bba7f41))
* **python:** accept io/fs.FS as root filesystem parameter ([#813](#813)) ([87b97e8](87b97e8))
* **reviewbot:** add Python interpreter with repo filesystem ([#814](#814)) ([b40ff1c](b40ff1c))
* **sakurajima:** add HTTP request timeouts to prevent hanging connections ([#837](#837)) ([d50a792](d50a792))
* **sakurajima:** add request size limits to prevent DoS attacks ([#838](#838)) ([f207855](f207855))
* **sakurajima:** add request size limits to prevent DoS attacks ([#839](#839)) ([80dd84a](80dd84a))
* **sakurajima:** production readiness fixes and enhancements ([#834](#834)) ([4368e6f](4368e6f))
* **sapientwindex:** add state to prevent double-posts ([#825](#825)) ([6ba9223](6ba9223))
* **skills:** add experimental Xe writing style skill ([baed3bd](baed3bd))
* **skills:** add Go table-driven tests skill ([#817](#817)) ([a2e35ea](a2e35ea))
* **store:** add filesystem backends (DirectFile, JSONMutexDB, CAS) ([#824](#824)) ([4f694cf](4f694cf))
* **totpgen:** add TOTP code generator command ([#833](#833)) ([d0a556d](d0a556d))

### BREAKING CHANGES

* **python:** llm/codeinterpreter/python.Run() now takes fs.FS as first parameter

Assisted-by: GLM 4.6 via Claude Code
Reviewbot-request: yes

Signed-off-by: Xe Iaso <me@xeiaso.net>

Signed-off-by: Mimi Yasomi <mimi@techaro.lol>
@Xe
Copy link
Owner Author

Xe commented Feb 16, 2026

🎉 This PR is included in version 1.30.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Xe Xe added the released label Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant