How ktaffy/wren works
Wren is an RPC framework: a Python client sends method calls over TCP to the C server, which dispatches them to registered handlers and returns a response or error. The C runtime also provides typed payload encoding/decoding and per-call handler APIs. The separate wrengen tool parses and validates service schemas for code generation; the available excerpts show its lexer and parser, but not its CLI or generation wiring. The graph omits uncertain connections and reflects only documented or sampled runtime behavior.
Main entry points: conn.c Connection I/O · server.c Server loop · dispatch.c Call dispatch · call.c Handler call API
Components 16
C RPC server
- Server loop
c/src/server/server.c - Connection accept
c/src/server/accept.c - Connection I/O
c/src/server/conn.c - Call dispatch
c/src/server/dispatch.c - Registered handlers
c/include/wren/server.h - Handler call API
c/src/server/call.c - Protocol codecs
c/src/proto.c
Python client
- Client API
python/src/wren/client.py
Schema tooling
- Generator CLI
wrengen/src/wrengen/cli.py - Schema lexer
wrengen/src/wrengen/lexer.py - Schema parser
wrengen/src/wrengen/parser.py - Schema AST
wrengen/src/wrengen/ast.py - Schema validation
wrengen/src/wrengen/validate.py
Other components
- RPC caller
- TCP connection
- Schema author
Connections 18
- RPC caller → Client API: calls
- Client API → TCP connection: sends call
- TCP connection → Server loop: connects
- Server loop → Connection accept: handles readiness
- Connection accept → Connection I/O: creates connection
- Server loop → Connection I/O: handles events
- Connection I/O → Protocol codecs: decodes header
- Connection I/O → Call dispatch: dispatches call
- Call dispatch → Registered handlers: looks up method
- Call dispatch → Handler call API: invokes handler
- Handler call API → Protocol codecs: encodes reply
- Handler call API → Connection I/O: writes response
- Connection I/O → TCP connection: sends response
- Schema author → Generator CLI: provides schema
- Generator CLI → Schema parser: parses input
- Schema parser → Schema lexer: tokenizes via
- Schema parser → Schema AST: builds
- Generator CLI → Schema validation: validates schema