tidaldb/tidal-net/proto/wal_shipping.proto
jordan.washburn fe711870be feat: M8 phases 7-10 — gRPC transport, cluster server, scatter-gather, multi-node UAT
Delivers the distributed fabric's network layer and HTTP cluster surface:

**m8p7: tidal-net crate (gRPC transport)**
- GrpcTransport implementing Transport trait via tonic 0.12
- Per-peer circuit breaker (Closed/Open/HalfOpen), mutual TLS via rustls
- Boxed error types (clippy-clean), graceful mutex recovery, debug_assert
  against calling block_on from tokio context
- Proto: WalShipping service (ShipSegment, StreamSegments stub, Heartbeat)
- 19 tests: contract, mTLS, reconnection, multi-node UAT, benchmarks

**m8p8: cluster subcommand + HTTP routes**
- ClusterState wrapping SimulatedCluster with region name mapping
- Routes: /health, /cluster/status, /cluster/promote, /partition, /heal
- Data routes: /items, /embeddings, /signals, /feed, /search (region-aware)
- Ranking profiles wired through ClusterConfig to all cluster nodes
- Topology YAML config, docker/cluster/Dockerfile (ENTRYPOINT+CMD, non-root)

**m8p9: scatter-gather query routing**
- Entity-sharded writes via Knuth multiplicative hash
- Scatter-gather RETRIEVE and SEARCH with deadline propagation (50ms-5ms)
- Partial failure: degraded=true with unavailable_shards metadata
- 6 tests: distribution, determinism, multi-shard retrieve, degraded
  partial results, deadline propagation, scatter-gather search

**m8p10: gRPC transport integration tests**
- 8 tests over real gRPC: replication convergence, idempotent replay,
  mixed signals, 3-node fan-out, partition/heal, degraded follower, perf
- Documented as tier-2 (in-process+gRPC); tier-3 multi-process pending
2026-04-11 13:51:08 -06:00

57 lines
1.5 KiB
Protocol Buffer

syntax = "proto3";
package tidal.replication.v1;
// Globally unique identifier for a WAL segment.
message WalSegmentId {
uint32 region_id = 1;
uint32 shard_id = 2;
uint64 seqno = 3;
}
// A WAL segment ready for shipping to a peer shard.
message ShipSegmentRequest {
WalSegmentId id = 1;
bytes payload = 2;
uint64 event_count = 3;
}
// Response to a segment shipment.
message ShipSegmentResponse {
bool accepted = 1;
}
// Request to stream segments from a given sequence number.
message StreamRequest {
uint32 shard_id = 1;
uint64 from_seqno = 2;
}
// Heartbeat request matching ControlPlane's ShardStats.
message HeartbeatRequest {
uint32 shard_id = 1;
uint32 region_id = 2;
uint64 entity_count = 3;
double signal_throughput_eps = 4;
uint64 disk_bytes = 5;
// Replication lag per peer region (region_id -> lag in events).
map<uint32, uint64> replication_lag = 6;
uint64 last_heartbeat_ns = 7;
}
// Heartbeat acknowledgement.
message HeartbeatResponse {
bool acknowledged = 1;
}
// WAL segment shipping service between tidalDB shards.
service WalShipping {
// Ship a single WAL segment to a peer shard (unary).
rpc ShipSegment(ShipSegmentRequest) returns (ShipSegmentResponse);
// Stream WAL segments from a given sequence number (server-streaming).
rpc StreamSegments(StreamRequest) returns (stream ShipSegmentRequest);
// Periodic health check for the ControlPlane.
rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse);
}