How fangfengxiang/lua-yar works
Lua-Yar is a pure-Lua Yar RPC framework. A client calls a remote method using a selected transport; a server accepts requests, dispatches registered methods, and returns results. The README also documents JSON/Msgpack codecs, protocol compatibility, custom packagers, hooks, and several host environments. The source excerpts were unavailable, so internal module connections are left unverified rather than presented as observed calls.
Main entry points: init.lua Server API · client.lua RPC Client · transport.lua Transport Selection · protocol.lua Protocol
Components 26
RPC API
- RPC Client
src/yar/client.lua - RPC Errors
src/yar/error.lua - Logging
src/yar/log.lua - Utilities
src/yar/util.lua
Wire Format
- Request Message
src/yar/message/request.lua - Response Message
src/yar/message/response.lua - Protocol
src/yar/protocol/protocol.lua - Protocol Header
src/yar/protocol/header.lua - Binary Framing
src/yar/protocol/framing.lua - Packager Registry
src/yar/packager/packager.lua - JSON Codec
src/yar/packager/json.lua - Msgpack Codec
src/yar/packager/msgpack.lua
Transports
- Transport Selection
src/yar/transport/transport.lua - Address Resolution
src/yar/transport/resolve.lua - HTTP Transport
src/yar/transport/http.lua - TCP Transport
src/yar/transport/tcp.lua - Socket I/O
src/yar/transport/socket.lua - Transport Constants
src/yar/transport/constants.lua
Server Runtime
- Server API
src/yar/server/init.lua - Method Dispatcher
src/yar/server/dispatcher.lua - Server Daemon
src/yar/server/daemon.lua - HTTP Server
src/yar/server/http.lua - TCP Server
src/yar/server/tcp.lua - Server Constants
src/yar/server/constants.lua
Other components
- Application
- Remote Yar Service
Connections 19
- Application → RPC Client: calls
README.md - RPC Client → Remote Yar Service: RPC request
README.md - Application → Server API: registers methods
README.md - Application → Server API: starts server
README.md - Server API → Method Dispatcher: dispatches
- RPC Client → Request Message: builds request
- RPC Client → Response Message: handles response
- Protocol → Protocol Header: uses header
- Protocol → Binary Framing: frames data
- Packager Registry → JSON Codec: selects codec
- Packager Registry → Msgpack Codec: selects codec
- RPC Client → Transport Selection: selects transport
- Transport Selection → HTTP Transport: routes HTTP
- Transport Selection → TCP Transport: routes TCP
- Transport Selection → Address Resolution: resolves address
- TCP Transport → Socket I/O: uses sockets
- Server API → HTTP Server: listens HTTP
- Server API → TCP Server: listens TCP
- Server API → Server Daemon: runs loop