Documentation
¶
Overview ¶
Package rpcserver serves the notesd API on lodge's kit (github.com/frostyard/lodge/kit/jsonrpc): rpc.hello, events.subscribe and a caller identity per connection. The kit does the framing, the gating on rpc.hello, concurrent dispatch, panics and oversized replies.
Index ¶
- type Options
- type Server
- func (s *Server) Hello(ctx context.Context, p *api.RPCHelloParams) (*api.Hello, error)
- func (s *Server) Listen(path string) (net.Listener, error)
- func (s *Server) Ping(context.Context, *api.RPCPingParams) error
- func (s *Server) Serve(ctx context.Context, ln net.Listener, r *api.Router) error
- func (s *Server) ServeConn(ctx context.Context, nc net.Conn, r *api.Router, id api.Identity)
- func (s *Server) Subscribe(ctx context.Context, p *api.EventsSubscribeParams) (*api.Subscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Name is reported by rpc.hello, e.g. "notesd v0.1.0".
Name string
Broker *events.Broker
Logger *slog.Logger
}
Options configures a Server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements api.RPCService and api.EventsService, which need the connection, and serves a Router built with them.
func (*Server) Serve ¶
Serve accepts connections on notesd's socket until ctx ends, then waits for them to finish. Each serves api.CallerLocal.
func (*Server) ServeConn ¶
ServeConn serves one connection that its listener has already authenticated as id (the development gateway, and lodge's sessions and agents) until it ends or ctx does.
func (*Server) Subscribe ¶
func (s *Server) Subscribe(ctx context.Context, p *api.EventsSubscribeParams) (*api.Subscription, error)
Subscribe implements events.subscribe; delivery starts after the reply.