Documentation
¶
Index ¶
- Variables
- type Context
- type MethodDesc
- type Server
- func (s *Server) Close()
- func (s *Server) Register(v any) error
- func (s *Server) Serve(ctx context.Context, ln net.Listener, cf codec.CodecFunc)
- func (s *Server) ServeConn(ctx context.Context, conn io.ReadWriter, cf codec.CodecFunc)
- func (s *Server) ServeWS(ctx context.Context, addr string, cf codec.CodecFunc) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidType = errors.New("type must be struct or pointer to struct") ErrNoSuchReceiver = errors.New("no such receiver registered") ErrNoSuchMethod = errors.New("no such method was found") ErrInvalidMethod = errors.New("method invalid for lrpc call") ErrArgNotProvided = errors.New("method expected an argument, but none was provided") )
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is a connection context for RPC calls
func (*Context) Deadline ¶
Deadline always returns the current time and false as this context does not support deadlines
func (*Context) Done ¶
func (ctx *Context) Done() <-chan struct{}
Done returns a channel that will be closed when the context is canceled, such as when ChannelDone is called by the client
func (*Context) Err ¶
Err returns context.Canceled if the context was canceled, otherwise nil
func (*Context) GetCodec ¶
GetCodec returns a codec bound to the connection that called this function
func (*Context) MakeChannel ¶
MakeChannel changes the function it's called in into a channel function, and returns a channel which can be used to send information to the client.
This will ovewrite any return value of the function with a channel ID.
type MethodDesc ¶
MethodDesc describes methods on a receiver
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an lrpc server
func (*Server) Register ¶
Register registers a value to be called by a client
func (*Server) Serve ¶
Serve starts the server using the provided listener and codec function
func (*Server) ServeConn ¶
ServeConn uses the provided connection to serve the client. This may be useful if something other than a net.Listener needs to be used