CraftReplDev: CRAFT-mode replication device foundation#164
Conversation
Introduces SOLO (default, existing ReplDev path) and CRAFT (new CraftReplDev path) so callers can select the replication backend per-volume without affecting existing code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Creates src/lib/craft/ with its own CMakeLists.txt defining the homeblocks_craft OBJECT target. Wires it into the parent build via add_subdirectory(craft) and links its objects into the final homeblocks library. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ration Defines all CRAFT wire types (CraftPartitionState, LSNPair, LoginResult, JournalSlot, replica_endpoint), the CraftJournalBackend abstraction for mock-testability, and the full CraftReplDev class with its nested CraftRaftListener. No implementation yet — that is Chunk 4. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements get_lsns() and get_rs_commit_lsn() which snapshot the in-memory CraftPartitionState. All other methods are stubbed returning not_supported; CraftRaftListener::on_commit and the two RAFT apply helpers are likewise stubbed pending S5. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| READONLY); | ||
|
|
||
| // Selects the replication backend for a volume. | ||
| // SOLO — existing solo ReplDev (raid1-style, data through RAFT log). |
There was a problem hiding this comment.
There is no RAFT in solo ReplDev; just the data journal. Maybe we just call this "DISABLED" or "NONE"?
There was a problem hiding this comment.
Will change it to Disabled
|
This looks good! It's at least a starting point if not 100% correct; but gives us something to "speak to" when we have our CRAFT discussions. 👍 |
There was a problem hiding this comment.
Pull request overview
Implements the initial scaffolding for CRAFT-mode replication by introducing a new CraftReplDev abstraction (parallel to HomeStore’s ReplDisk) and wiring a new homeblocks_craft OBJECT library into the build so CRAFT components can be compiled/linked without affecting existing (SOLO) volumes.
Changes:
- Added
replication_mode(SOLO/CRAFT) andrepl_modetovolume_info(defaulting toSOLO) in the public API. - Added new
src/lib/craft/module containing CRAFT wire types, a journal backend interface for testability, and aCraftReplDevclass with initial implementations forget_lsns()/get_rs_commit_lsn()plus stubs for future stories. - Integrated the new craft OBJECT library into
src/liband linked its object files into the finalhomeblockslibrary target.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/volume/CMakeLists.txt | Links the new craft OBJECT library objects into the main library build. |
| src/lib/craft/craft_repl_dev.hpp | Introduces CRAFT wire types, CraftJournalBackend, and the CraftReplDev interface + RAFT listener declaration. |
| src/lib/craft/craft_repl_dev.cpp | Implements constructor and LSN snapshot methods; adds ENOTSUP stubs for remaining methods. |
| src/lib/craft/CMakeLists.txt | Defines the new ${PROJECT_NAME}_craft OBJECT library. |
| src/lib/CMakeLists.txt | Adds the craft/ subdirectory to the build. |
| src/include/homeblks/home_blocks.hpp | Adds replication_mode and a repl_mode field to volume_info, including updated move-ctor and to_string(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Bumped version
Summary
Implements the S1 foundation for CRAFT-mode replication.
Introduces
CraftReplDevas a parallel to HomeStore'sReplDisk— CRAFT-modevolumes will own one of these instead of the solo
repl_dev. Non-CRAFT volumesare completely unaffected.
Changes
home_blocks.hpp: Addreplication_modeenum (DISABLED/CRAFT) and arepl_modefield tovolume_info(defaults toSOLO; all existing callerscompile unchanged).
src/lib/craft/CMakeLists.txt: Newhomeblocks_craftOBJECT library;wired into
src/lib/viaadd_subdirectoryand linked into the finalhomeblockslibrary.craft_repl_dev.hpp: All CRAFT wire types (CraftPartitionState,LSNPair,LoginResult,JournalSlot,replica_endpoint), theCraftJournalBackendabstract interface (enables mock injection for unittests per AC), and the full
CraftReplDevclass declaration including thenested
CraftRaftListener.craft_repl_dev.cpp: Constructor, realget_lsns()/get_rs_commit_lsn()implementations, and stubs (returning
ENOTSUP) for all remaining methodspending S2–S7.
What is NOT in this PR
All method bodies except
get_lsns/get_rs_commit_lsnare stubs. Subsequentstories fill them in: S2 (write), S3 (commit/read), S4 (truncate), S5 (RAFT
entries), S6 (peer data exchange), S7 (login orchestration).
Test plan
conan create . -c tools.build:skip_test=Truebuilds cleanly with the newOBJECT library linked in
CraftReplDevwill be added in S2 (src/tests/craft/)once the write path exists
🤖 Generated with Claude Code