cockroachdb/cockroach
Inter-node RPC services
CockroachDB nodes talk to each other over gRPC and DRPC. The proto definitions live next to the consuming subsystems; the connection plane lives in pkg/rpc/.
Major services
| Service | Proto | Used for |
|---|---|---|
Internal |
pkg/kv/kvpb/api.proto |
Batch (KV) — the main KV RPC |
RaftMessageBatch |
pkg/kv/kvserver/storage_services.proto |
Raft messages between peers |
MultiRaft |
pkg/kv/kvserver/storage_services.proto |
Streaming raft transport |
Heartbeat |
pkg/rpc/heartbeat.proto |
Connection liveness + clock offset |
Admin, Status |
pkg/server/serverpb/admin.proto, status.proto |
REST/RPC admin/status surface |
KeyVisualizerService |
pkg/keyvisualizer/ |
Key visualizer time-series |
Migration |
pkg/upgrade/migrationpb/ |
Cluster-version migration coordination |
BlobService |
pkg/blobs/ |
nodelocal file transfers |
Streaming |
pkg/repstream/streampb/ |
Cross-cluster replication producer |
LogicalReplication |
pkg/crosscluster/logical/ |
LDR ingestion |
Consensus |
pkg/kv/kvserver/storeliveness/ |
Store-liveness fabric |
Each .proto carries its DRPC counterpart via pkg/cmd/protoc-gen-go-drpc/.
Connection management
Every outbound call goes through pkg/rpc/nodedialer/Dialer.Dial(...), which:
- Resolves the target node's address from gossip.
- Returns a per-class connection from the
peer.Peerpool. - Returns an error if the target is unreachable, unhealthy, or wrong cluster.
Multiple "RPC classes" (pkg/rpc/rpcbase/) keep latency-sensitive and bulk traffic on separate streams so head-of-line blocking on bulk transfers can't slow down user-visible RPCs.
Authentication
Both gRPC and DRPC use mutual TLS by default. Server-side, pkg/rpc/auth.go validates the client cert; for multi-tenant deployments, auth_tenant.go enforces that the certificate's tenant ID matches the request payload.
Related pages
- systems/rpc — connection-management details.
- systems/security — TLS material.
- systems/kv —
BatchRequestis the main RPC. - systems/raft — Raft transport sits on top of
MultiRaft.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.