Repository navigation
feat: optional edit log with as-of replay - #21
Merged
Merged
Conversation
Adds the optional journal feature (FUSEY_JOURNAL_ENABLED), supporting two
new subcommands / mount modes:
- `fusey journal-dump` prints the recorded edit log in human-readable
(or JSON) form.
- `fusey mount <mp> --as-of=<ts>` mounts the filesystem as it existed at
wall-clock time ts, read-only.
Design choices:
- TouchAtime is deliberately NOT journaled (high-frequency, no replay
value). All other mutating operations on the index are recorded.
- Shards are append-only and named by their starting sequence number,
matching the chunk store's RecoverNextSeq pattern.
- `fusey compact` deletes the journal at the START of its cycle, BEFORE
any chunk remap. A fresh base snapshot is written at the END.
- As-of mounts use `-o ro` so the kernel rejects writes with EROFS.
- The base snapshot is stored as {prefix}index-base.cbor.
Code layout:
- `internal/journal/{event,journal,persist,apply,dump,wrap}.go` — Go
implementation. `JournaledIndex` wraps *index.Index and pairs every
mutating call with a journal append.
- `specs/journal.qnt` + new `JournalEvent` variants in types.qnt,
re-declared in filesystem.qnt alongside the existing index/chunks state.
- `ObjectStore` interface extended with `JournalKey`, `DeleteJournalKey`,
and `Prefix` so the journal works with both S3 and broker stores.
- FUSE layer takes an `FSIndex` interface so the same code path serves
both the bare index (journal disabled) and the wrapper (enabled).
Resolve merge conflicts in README.md, cmd/fusey/main.go, and internal/config/config.go by keeping both sides' additions: - Journal edit-log feature (FUSEY_JOURNAL_ENABLED, journal-dump, --as-of) - AllowOther mount option (FUSEY_ALLOW_OTHER, version subcommand) The mount path now uses cfg.AllowOther instead of a hardcoded false, while preserving the journal wiring and read-only as-of mode. Co-authored-by: openhands <openhands@all-hands.dev>
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.
Summary
Adds the optional edit log (
FUSEY_JOURNAL_ENABLED) to Fusey, supporting two new features:fusey journal-dump— a debug subcommand that prints every recorded edit (with timestamp, sequence number, and full op fields) in either human-readable or JSON form. Useful for auditing "what changed?" without leaving the CLI.fusey mount <mp> --as-of=<ts>— a read-only mount of the filesystem as it existed at wall-clock timets(RFC 3339, with optional sub-second precision). Lets you answer "what was the state at 10:00?" and copy historical files out viacp -a.Design decisions (locked in up-front with the user)
{prefix}journal-NNNNNNNNN.cborwhereNis the starting sequence number of the batch. Existing shards are never overwritten — same shape as the chunk store'sRecoverNextSeq.fusey compactdeletes the journal at the START of its cycle, before any chunk remap. If compact crashes mid-cycle, the next mount has an empty journal but the index+chunks are in a consistent post-remap state; as-of mounts simply error during that window. A fresh base snapshot is written at the end.-o ro, so the kernel rejects all writes withEROFS. Recovery iscp -a <as-of-mp>/path /live-mp/path.{prefix}index-base.cbor. As-of replay = base + journal entries withts <= targetTs.Code layout
Wiring
cmd/fusey/main.go: builds aJournaledIndexwhen the flag is on;buildPersistFnflushes journal shards alongside the existing local + remote index flushes (order: index, chunk, journal, remote index).runCompactcallsjournal.Clearat the start andjournal.SaveBaseat the end. New subcommandfusey journal-dump [--json]. Newfusey mount <mp> [--as-of=<ts>]flag.internal/fuse/fs.go: switched to anFSIndexinterface so the FUSE layer is agnostic to whether it holds a bare*index.Indexor a*journal.JournaledIndex. ThereadOnlyflag is plumbed through to the FUSE mount options.internal/chunks/store.go:ObjectStoreinterface extended withJournalKey,DeleteJournalKey, andPrefixso the journal works correctly under both S3 (with prefix) and broker (flat namespace) stores.Build & test
go build ./...— cleango test ./...— all packages green, including the 14 new journal testsgo vet ./...— cleanTest coverage highlights
TestJournalFlushAndLoad— roundtrip via the object storeTestJournalMultipleShardsOrderedBySeq— multiple shards sorted correctly on loadTestJournalClearRemovesShards—Clearremoves every shardTestApplyReplayMatchesLiveOps— the journal + Apply produces the same state as the live indexTestReplayUpToFiltersByTimestamp—ts <= targetTsboundaryTestJournaledIndexRemoveDirEntryEmitsDeleteInodeOnNlinkZero— wrapper emits both opsTestJournaledIndexRenameEmitsDeleteInodeOnReplace— replacement at rename timeTestDumpHumanReadable/TestDumpJSON— both formatsOperator notes
FUSEY_JOURNAL_ENABLED=true, the nextfusey compactwill write a base snapshot so as-of mounts work. Until that happens, as-of mounts error with "no base snapshot found".daemon.pidfile, sofusey unmountdoes not see them — kill the parentfusey mountprocess to stop one.Documentation
README.md: new "Journal (optional edit log)" section, updated config / spec / project-status tables.AGENTS.md: new design-decision entry (chore: add GoReleaser for binary releases #12) covering the journal.Not in this PR
internal/journal/wrap.go.index.qntandchunks.qntagainst the latest Quint. The Go implementation is the source of truth; the spec models the design. Per AGENTS.md, specs may need minor corrections against the actual Quint compiler.