etcd-io/etcd
server
The largest module — everything the etcd binary does. Source: server/.
Scope
go.etcd.io/etcd/server/v3 packages the cluster member, including:
- Flag parsing and process bootstrap (
etcdmain/,embed/,config/). - Core server logic (
etcdserver/). - Storage stack (
storage/). - Auth and lease subsystems (
auth/,lease/). - gRPC and HTTP surfaces (
etcdserver/api/v3rpc/,etcdserver/api/etcdhttp/). - Peer transport (
etcdserver/api/rafthttp/). - Stateless modes (
etcdmain/gateway.go,etcdmain/grpc_proxy.go,proxy/). - Feature-gate definitions (
features/). - Verifier helpers (
verify/).
For deep dives into individual components, see systems/.
Subpackage map
| Path | One-liner |
|---|---|
server/main.go |
Process entry; calls etcdmain.Main. |
server/etcdmain/ |
Flag parsing, mode selection (server/gateway/grpc-proxy), help text. |
server/embed/ |
Library form of etcd; embed.Etcd, embed.Config. |
server/etcdserver/ |
EtcdServer, raft loop, apply pipeline, txn engine, version manager. |
server/etcdserver/api/ |
All RPC and HTTP surfaces, plus snapshot store, membership, discovery, alarms. |
server/etcdserver/api/v3rpc/ |
gRPC service implementations. |
server/etcdserver/api/etcdhttp/ |
/health, /metrics, /version, debug, peer health/version. |
server/etcdserver/api/rafthttp/ |
HTTP-based Raft transport. |
server/etcdserver/api/snap/ |
Snapshot file store. |
server/etcdserver/api/membership/ |
Cluster member registry, learner promotion. |
server/etcdserver/api/v3compactor/ |
Periodic + revision-based compaction. |
server/etcdserver/api/v3discovery/ |
Discovery v3 client. |
server/etcdserver/api/v3alarm/ |
NOSPACE / CORRUPT alarm management. |
server/etcdserver/api/v3client/ |
In-process client used by v3election / v3lock. |
server/etcdserver/api/v3election/ |
Election service (gRPC). |
server/etcdserver/api/v3lock/ |
Distributed lock service (gRPC). |
server/etcdserver/apply/ |
Apply uberApplier and per-op handlers. |
server/etcdserver/cindex/ |
Consistent-index tracker (last-applied). |
server/etcdserver/errors/ |
Sentinel server-side errors. |
server/etcdserver/read/ |
Read-index helpers. |
server/etcdserver/txn/ |
Transaction evaluation (If/Then/Else). |
server/etcdserver/version/ |
Server-version + cluster-version negotiation. |
server/auth/ |
RBAC store, simple + JWT tokens, range-permission cache. |
server/config/ |
Server-side Config (consumed by EtcdServer). |
server/features/ |
Server feature-gate registry. |
server/lease/ |
TTL leases, expiration heap, checkpoints. |
server/storage/ |
Storage facade + per-implementation packages. |
server/storage/backend/ |
bbolt wrapper, batched read/write tx, freelist mgmt. |
server/storage/datadir/ |
Layout helpers for <data-dir>. |
server/storage/mvcc/ |
MVCC store, watcher group, hash storage. |
server/storage/schema/ |
Bolt buckets, schema versioning, migrations. |
server/storage/wal/ |
Write-ahead log. |
server/proxy/grpcproxy/ |
gRPC proxy mode (caching). |
server/proxy/tcpproxy/ |
TCP/L4 proxy mode (gateway). |
server/verify/ |
Boot- and shutdown-time invariants (debug builds). |
server/mock/ |
Test doubles for the storage stack. |
Cross-cutting choices
- Logging: every constructor accepts a
*zap.Logger. The default is structured JSON. - Metrics: every package owns a
metrics.go; metrics are registered toprometheus.DefaultRegisterer. - Errors: sentinel package-level errors; no panics in normal control flow.
- Concurrency: explicit named mutexes; long-running goroutines are launched with
EtcdServer.goAttachso shutdown can wait for them. - Testing: every non-trivial file ships a corresponding
_test.go; the cluster-level tests live intests/integration/rather than here.
Active contributors
CODEOWNERS-equivalent lives in OWNERS and OWNERS_ALIASES. Recent committers across server/ (last 90 days) include Benjamin Wang (ahrtr), Marek Siarkowicz (serathius), Chun-Hung Tseng (henrybear327), Jordan Liggitt, Ivan Valdes, Jefftree, joshjms, and Wei Fu.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.