qkc/slave 05: add MasterConn protocol layer - #37
Open
iteyelmp wants to merge 99 commits into
Open
Conversation
# Conflicts: # qkc/cluster/slave/compat_test.go
# Conflicts: # qkc/cluster/wire/messages_test.go
# Conflicts: # qkc/cluster/conn/base.go # qkc/cluster/conn/base_test.go
…ShardIDs are not set.
# Conflicts: # qkc/cluster/slave/xshard_conn.go # qkc/cluster/slave/xshard_pool.go # qkc/cluster/slave/xshard_test.go
qzhodl
reviewed
Sep 7, 2026
| mc.BaseConn = conn.NewBaseConn(conn.Config{ | ||
| Transport: conn.NewTCPTransport(cfg.Conn, readFrame, wire.WriteFrame), | ||
| Serializers: map[byte]*conn.OpSerializer{ | ||
| // §1 Cluster initialisation |
There was a problem hiding this comment.
Why is this labeled “Cluster initialisation” when it also includes runtime operations such as ADD_ROOT_BLOCK, GET_ACCOUNT_DATA, and ADD_TRANSACTION?
qzhodl
reviewed
Sep 7, 2026
| } | ||
|
|
||
| func (mc *MasterConn) handleAddRootBlock(req any) (any, error) { | ||
| return mc.handler.AddRootBlock(req.(*wire.AddRootBlockRequest)) |
There was a problem hiding this comment.
[P1] Python calls create_shards(req.root_block) after ADD_ROOT_BLOCK, but this path only delegates AddRootBlock. Shards activated after startup will never be created or receive PeerConns.
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.
Add MasterConn: the slave-side master↔slave connection layer
Introduces
MasterConn, the slave-side TCP connection to the cluster master, built on the existingBaseConn.This PR establishes protocol compatibility, opcode registration, request dispatch, and handler delegation. Cluster business logic remains out of scope.
Scope
ClusterMetadataframing over TCP.DESTROY_CLUSTER_PEER_CONNECTION_COMMAND.SendAddMinorBlockHeaderSendAddMinorBlockHeaderListSlaveConnHandler(communication and topology orchestration);MasterHandler(business RPC handling).Not in Scope
Reviewer Notes
Handler boundary
MasterConn owns protocol framing, opcode dispatch, and connection-level behavior.
PING always replies with PONG. When
PingRequest.RootTipis present, it additionally delegates shard creation/update throughSlaveConnHandler.This matches Python's
MasterConnection.handle_ping, where PING serves both as the initial handshake and as the trigger for shard creation/update.All other master-driven operations are delegated through handler interfaces.
CREATE / DESTROY semantics
CREATE is a normal request/response RPC.
DESTROY is the sole non-RPC opcode.
Its serializer carries a placeholder
ResponseOpCode = 0only because the generic serializer registration requires one. The value is ignored for non-RPC opcodes and never appears on the wire.Full Codex 5.6 review completed.