How pikalabs/pink works
Pink is a pthread-based networking library. Its principal server workflow accepts client connections and either handles them in one HolyThread or dispatches them to worker threads, where connection objects process protocol requests and replies. It also provides HTTP, protobuf, and Redis connection/client implementations, plus a separate pub/sub thread. The graph reflects documented and indexed relationships; unsampled subsystems are included by their exact tree paths, but their internal interactions are not inferred.
Main entry points: server_thread.h Server API · worker_thread.cc Worker Thread · pink_epoll.cc Epoll Handler · dispatch_thread.cc Dispatch Thread
Components 21
Server Threads
- Server API
pink/include/server_thread.h - Server Loop
pink/src/server_thread.cc - Listening Sockets
pink/src/server_socket.cc - Dispatch Thread
pink/src/dispatch_thread.cc - Holy Thread
pink/src/holy_thread.cc - Worker Thread
pink/src/worker_thread.cc - Epoll Handler
pink/src/pink_epoll.cc
Connections
- Connection Interface
pink/src/pink_conn.cc - Protobuf Connection
pink/src/pb_conn.cc - HTTP Connection
pink/src/http_conn.cc - Simple HTTP
pink/src/simple_http_conn.cc - Redis Connection
pink/src/redis_conn.cc
Client APIs
- Client Base
pink/src/pink_cli.cc - Protobuf Client
pink/src/pb_cli.cc - Redis Client
pink/src/redis_cli.cc
Threading And PubSub
- Thread Base
pink/src/pink_thread.cc - Background Thread
pink/src/bg_thread.cc - Periodic Thread
pink/src/period_thread.cc - PubSub Thread
pink/src/pink_pubsub.cc
Other components
- Application
- Network Clients
Connections 19
- Application → Server API: configures
- Network Clients → Listening Sockets: connects to
- Server API → Dispatch Thread: creates
pink/include/server_thread.h - Server API → Holy Thread: creates
pink/include/server_thread.h - Server API → Server Loop: starts
pink/include/server_thread.h - Server Loop → Listening Sockets: uses
pink/src/server_thread.cc - Dispatch Thread → Worker Thread: dispatches connections
- Dispatch Thread → Epoll Handler: polls events
pink/src/dispatch_thread.cc - Holy Thread → Epoll Handler: polls events
pink/src/holy_thread.cc - Worker Thread → Epoll Handler: polls events
pink/src/worker_thread.cc - Worker Thread → Connection Interface: creates via factory
pink/src/worker_thread.cc - Worker Thread → Connection Interface: reads and replies through
pink/src/worker_thread.cc - Protobuf Client → Client Base: uses
pink/src/pb_cli.cc - Redis Client → Client Base: uses
pink/src/redis_cli.cc - Application → Client Base: uses
- Thread Base → Background Thread: base class
- Thread Base → Periodic Thread: base class
- PubSub Thread → Connection Interface: tracks connections
pink/src/pink_pubsub.cc - PubSub Thread → Epoll Handler: polls events
pink/src/pink_pubsub.cc