How itsk4tune/gatekeeper works
GateKeeper is an in-memory key-value, rate-limiting, quota, and idempotency server with GKWP/TCP and HTTP interfaces. Clients send requests through the dual-protocol listener to protocol-specific processing and domain operations backed by shared memory storage; optional AOF supports replay and persistence. The README documents the major features and protocols, while excerpts show server wiring and selected HTTP, storage, and idempotency behavior. Several internal TCP and domain call paths are not sampled, so uncertain links are omitted or marked unverified.
Main entry points: server_main.cpp Server Bootstrap · dispatcher.cpp Command Dispatcher · server.cpp Dual-Protocol Server · http_service.cpp HTTP API
Components 24
Clients and CLI
- Client SDKs
sdk - Server CLI
src/cli/app.cpp
Server Runtime
- Server Bootstrap
src/server_main.cpp - Server Config
src/core/config/server_config.cpp - Logging
include/gatekeeper/core/log/logger.h - Dual-Protocol Server
src/net/server.cpp - Event Loop
include/gatekeeper/net/event_loop.h
Protocols and Services
- TCP Channel
src/net/channel.cpp - GKWP Codec
include/gatekeeper/protocol/gkwp2/binary_codec.h - Stream Manager
src/protocol/gkwp2/stream_manager.cpp - HTTP Channel
include/gatekeeper/protocol/http/http_channel.h - HTTP API
src/service/http_service.cpp - TCP Processor
src/service/processor.cpp - JSON Reader
src/protocol/json_reader.cpp
Domain Operations
- Command Dispatcher
src/command/dispatcher.cpp - Key-Value and TTL
src/domain/kv - Rate Limiting
src/domain/ratelimit/counter_ops.cpp - Quota Reservations
src/domain/quota/reservation_ops.cpp - Idempotency
src/domain/idempotency/idempotency_ops.cpp - Connection Parking
src/domain/idempotency/parking_lot.cpp
Storage and Persistence
- Memory Store
src/storage/memory_store.cpp - AOF Writer
src/storage/aof/aof_writer.cpp - AOF Recovery
src/storage/aof/aof_loader.cpp
Other components
- Operator
Connections 27
- Operator → Server CLI: runs commands
src/cli/app.cpp - Server Bootstrap → Server Config: parses settings
src/server_main.cpp - Server Bootstrap → Logging: creates logger
src/server_main.cpp - Server Bootstrap → Command Dispatcher: creates dispatcher
src/server_main.cpp - Server Bootstrap → TCP Processor: routes TCP requests
src/server_main.cpp - Server Bootstrap → HTTP API: routes HTTP requests
src/server_main.cpp - Server Bootstrap → Dual-Protocol Server: starts listener
src/server_main.cpp - Server Bootstrap → AOF Recovery: replays log
src/server_main.cpp - Server Bootstrap → AOF Writer: configures persistence
src/server_main.cpp - Dual-Protocol Server → Event Loop: runs loops
- Dual-Protocol Server → TCP Channel: accepts TCP
src/net/server.cpp - Dual-Protocol Server → HTTP Channel: accepts HTTP
src/net/server.cpp - TCP Channel → TCP Processor: dispatches payload
- TCP Processor → Command Dispatcher: dispatches commands
- HTTP Channel → HTTP API: routes requests
- HTTP API → JSON Reader: parses bodies
src/service/http_service.cpp - Command Dispatcher → Memory Store: executes operations
- HTTP API → Memory Store: reads and writes
src/service/http_service.cpp - HTTP API → AOF Writer: appends mutations
src/service/http_service.cpp - Command Dispatcher → Key-Value and TTL: registers operations
src/command/dispatcher.cpp - Command Dispatcher → Rate Limiting: registers operations
src/command/dispatcher.cpp - Command Dispatcher → Quota Reservations: registers operations
src/command/dispatcher.cpp - Command Dispatcher → Idempotency: registers operations
src/command/dispatcher.cpp - Idempotency → Connection Parking: parks duplicates
- Client SDKs → Dual-Protocol Server: connects to
- GKWP Codec → Stream Manager: multiplexes streams
- AOF Recovery → Command Dispatcher: replays commands