Add NATS-distributed OpenFiles server mode with cache invalidation and docs#1
Closed
dywongcloud wants to merge 2 commits into
Closed
Add NATS-distributed OpenFiles server mode with cache invalidation and docs#1dywongcloud wants to merge 2 commits into
dywongcloud wants to merge 2 commits into
Conversation
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.
This PR adds optional NATS-based distribution to
openfiles-server, allowing multiple OpenFiles server instances to share work across a NATS queue group while using the object backend as the durable source of truth.What changed
[nats]configuration support.openfiles-server.Why
OpenFiles can now run as multiple HTTP gateways/workers against the same object-backed filesystem. This improves horizontal scalability and supports distributed processing without changing the core correctness model.
The object store remains the source of truth. NATS is used for coordination, work distribution, and cache invalidation — not as durable file storage.
Validation
Tested locally with:
127.0.0.1:9000127.0.0.1:4222127.0.0.1:8787127.0.0.1:8788Validated write/read across instances:
Reverse direction was also validated:
Both tests returned
20/20successful reads with the expected content.Notes
Reads intentionally remain local even when NATS is enabled. The object backend is shared, but cache files are per-process. Routing reads through a NATS queue group can hit a worker with stale cache metadata or missing local cache files. Local reads avoid that issue while still reading from the shared object backend.
CRDTs are not added for arbitrary file contents. This PR preserves the existing object-store conflict model and lost+found behavior. CRDT support can be layered later for specific structured file types such as JSON, collaborative text documents, or append-only logs.