Skip to content
2 changes: 1 addition & 1 deletion cpp/core/Msgs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct ShardReplicaId {
}

constexpr bool valid() const {
return replicaId().valid();
return (u16 >> 8) < 5;
}
};

Expand Down
38 changes: 38 additions & 0 deletions cpp/core/MsgsGen.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions cpp/core/MsgsGen.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions cpp/core/Protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ constexpr uint32_t PROXY_SHARD_REQ_PROTOCOL_VERSION = 0x5414853;
// '6414853'
constexpr uint32_t PROXY_SHARD_RESP_PROTOCOL_VERSION = 0x6414853;

// >>> format(struct.unpack('<I', b'SHA\7')[0], 'x')
// '7414853'
constexpr uint32_t SHARD_REPLICA_ANNOUNCEMENT_PROTOCOL_VERSION = 0x7414853;

// >>> format(struct.unpack('<I', b'CDC\0')[0], 'x')
// '434443'
constexpr uint32_t CDC_REQ_PROTOCOL_VERSION = 0x434443;
Expand Down Expand Up @@ -103,3 +107,14 @@ using LogReqMsg = SignedProtocolMessage<LOG_REQ_PROTOCOL_VERSION, LogReqContaine
using LogRespMsg = SignedProtocolMessage<LOG_RESP_PROTOCOL_VERSION, LogRespContainer>;
using ProxyShardReqMsg = SignedProtocolMessage<PROXY_SHARD_REQ_PROTOCOL_VERSION, ShardReqContainer>;
using ProxyShardRespMsg = SignedProtocolMessage<PROXY_SHARD_RESP_PROTOCOL_VERSION, ShardCheckPointedResp>;

// SignedProtocolMessage includes body.kind() in diagnostics. This fixed-body
// protocol has no discriminator, so provide a diagnostic name around the
// generated wire body.
struct ShardReplicaAnnouncementBody : ShardReplicaAnnouncement {
const char* kind() const {
return "SHARD_REPLICA_ANNOUNCEMENT";
}
};

using ShardReplicaAnnouncementMsg = SignedProtocolMessage<SHARD_REPLICA_ANNOUNCEMENT_PROTOCOL_VERSION, ShardReplicaAnnouncementBody>;
2 changes: 1 addition & 1 deletion cpp/shard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

include_directories(${ternfs_SOURCE_DIR}/core)

add_library(shard Shard.cpp Shard.hpp ShardDB.cpp ShardDB.hpp ShardDBData.cpp ShardDBData.hpp BlockServicesCacheDB.hpp BlockServicesCacheDB.cpp BlockServicePicker.hpp BlockServicePicker.cpp)
add_library(shard Shard.cpp Shard.hpp ShardDB.cpp ShardDB.hpp ShardDBData.cpp ShardDBData.hpp BlockServicesCacheDB.hpp BlockServicesCacheDB.cpp BlockServicePicker.hpp BlockServicePicker.cpp ReplicaTracker.hpp ReplicaTracker.cpp)
target_link_libraries(shard PRIVATE core crc32c)

add_executable(ternshard ternshard.cpp)
Expand Down
Loading