Skip to content

CraftReplDev: CRAFT-mode replication device foundation#164

Merged
sbinmalek merged 5 commits into
eBay:dev/v6.xfrom
sbinmalek:SDSTOR-22383
Jun 23, 2026
Merged

CraftReplDev: CRAFT-mode replication device foundation#164
sbinmalek merged 5 commits into
eBay:dev/v6.xfrom
sbinmalek:SDSTOR-22383

Conversation

@sbinmalek

@sbinmalek sbinmalek commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the S1 foundation for CRAFT-mode replication.
Introduces CraftReplDev as a parallel to HomeStore's ReplDisk — CRAFT-mode
volumes will own one of these instead of the solo repl_dev. Non-CRAFT volumes
are completely unaffected.

Changes

  • home_blocks.hpp: Add replication_mode enum (DISABLED / CRAFT) and a
    repl_mode field to volume_info (defaults to SOLO; all existing callers
    compile unchanged).

  • src/lib/craft/CMakeLists.txt: New homeblocks_craft OBJECT library;
    wired into src/lib/ via add_subdirectory and linked into the final
    homeblocks library.

  • craft_repl_dev.hpp: All CRAFT wire types (CraftPartitionState,
    LSNPair, LoginResult, JournalSlot, replica_endpoint), the
    CraftJournalBackend abstract interface (enables mock injection for unit
    tests per AC), and the full CraftReplDev class declaration including the
    nested CraftRaftListener.

  • craft_repl_dev.cpp: Constructor, real get_lsns() / get_rs_commit_lsn()
    implementations, and stubs (returning ENOTSUP) for all remaining methods
    pending S2–S7.

What is NOT in this PR

All method bodies except get_lsns / get_rs_commit_lsn are stubs. Subsequent
stories 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=True builds cleanly with the new
    OBJECT library linked in
  • Existing volume tests pass unchanged (non-CRAFT path untouched)
  • Unit tests for CraftReplDev will be added in S2 (src/tests/craft/)
    once the write path exists

🤖 Generated with Claude Code

sbinmalek and others added 4 commits June 22, 2026 15:27
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>
@sbinmalek sbinmalek marked this pull request as ready for review June 23, 2026 21:15
Comment thread src/include/homeblks/home_blocks.hpp Outdated
READONLY);

// Selects the replication backend for a volume.
// SOLO — existing solo ReplDev (raid1-style, data through RAFT log).

@szmyd szmyd Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no RAFT in solo ReplDev; just the data journal. Maybe we just call this "DISABLED" or "NONE"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change it to Disabled

@szmyd

szmyd commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

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. 👍

@szmyd szmyd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and repl_mode to volume_info (defaulting to SOLO) in the public API.
  • Added new src/lib/craft/ module containing CRAFT wire types, a journal backend interface for testability, and a CraftReplDev class with initial implementations for get_lsns() / get_rs_commit_lsn() plus stubs for future stories.
  • Integrated the new craft OBJECT library into src/lib and linked its object files into the final homeblocks library 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.

Comment thread src/lib/craft/craft_repl_dev.hpp
Comment thread src/lib/craft/craft_repl_dev.cpp
@sbinmalek sbinmalek changed the title [SDSTOR-22383] CraftReplDev: CRAFT-mode replication device foundation CraftReplDev: CRAFT-mode replication device foundation Jun 23, 2026
@sbinmalek sbinmalek merged commit b24caed into eBay:dev/v6.x Jun 23, 2026
26 checks passed
@sbinmalek sbinmalek deleted the SDSTOR-22383 branch June 23, 2026 23:10
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.

3 participants