Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterMessage(id uint64, mk func() Message)
- func RegisterStandardMessagesAndErrors(reg *Registry)
- func WriteRequest(w io.Writer, req Request) error
- func WriteResponse(w io.Writer, resp Response) error
- type Client
- func (c *Client) Close()
- func (c *Client) RawSend(oid uint64, paramType uint64, paramData []byte) (Response, error)
- func (c *Client) RawSendCtx(ctx context.Context, oid uint64, paramType uint64, paramData []byte) (Response, error)
- func (c *Client) RawSendParsedReply(reg *Registry, oid uint64, paramType uint64, paramData []byte) (interface{}, error)
- func (c *Client) RawSendParsedReplyCtx(ctx context.Context, reg *Registry, oid uint64, paramType uint64, ...) (interface{}, error)
- func (c *Client) Send(oid uint64, arg Message) (interface{}, error)
- func (c *Client) SendCtx(ctx context.Context, oid uint64, arg Message) (interface{}, error)
- func (c *Client) SendWithReg(reg *Registry, oid uint64, arg Message) (interface{}, error)
- func (c *Client) SendWithRegCtx(ctx context.Context, reg *Registry, oid uint64, arg Message) (interface{}, error)
- type ClientOptions
- type Clunk
- type ConnServer
- func (s *ConnServer) Clunk(oid uint64)
- func (s *ConnServer) Go(f func())
- func (s *ConnServer) HandleRequest(ctx context.Context, r Request, respond RespondFunc)
- func (s *ConnServer) Register(o Object) uint64
- func (s *ConnServer) RegisterBootstrap(o Object)
- func (s *ConnServer) Serve(ctx context.Context, c io.ReadWriteCloser)
- func (s *ConnServer) Wait()
- type ConnServerOptions
- type Message
- type Object
- type ObjectNotExist
- type ObjectRef
- type Ok
- type Registry
- type Request
- type RespondFunc
- type Response
- type Server
- type ServerOptions
- type UnexpectedMessage
Constants ¶
View Source
const ( // From spec TYPE_ERR = 0x81aba3f7522edc6b // From spec TYPE_OK = 0xd4924862b91c639d // From spec TYPE_CLUNK = 0xcf3a50d623ee637d // From spec TYPE_OBJECT_REF = 0xd782cf4b395eca05 // From spec TYPE_OBJECT_NOT_EXIST = 0xab0547366de885bc // From spec TYPE_UNEXPECTED_MESSAGE = 0xd47d4e94917934b2 // From spec BOOTSTRAP_OBJECT_ID = 0 )
Variables ¶
Functions ¶
func RegisterMessage ¶
func RegisterStandardMessagesAndErrors ¶
func RegisterStandardMessagesAndErrors(reg *Registry)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(conn io.ReadWriteCloser, options ClientOptions) *Client
func (*Client) RawSendCtx ¶
func (*Client) RawSendParsedReply ¶
func (*Client) RawSendParsedReplyCtx ¶
func (*Client) SendWithReg ¶
type ClientOptions ¶
type ConnServer ¶
type ConnServer struct {
// contains filtered or unexported fields
}
func NewConnServer ¶
func NewConnServer(c io.ReadWriteCloser, options ConnServerOptions) *ConnServer
func (*ConnServer) Clunk ¶
func (s *ConnServer) Clunk(oid uint64)
func (*ConnServer) Go ¶
func (s *ConnServer) Go(f func())
func (*ConnServer) HandleRequest ¶
func (s *ConnServer) HandleRequest(ctx context.Context, r Request, respond RespondFunc)
func (*ConnServer) Register ¶
func (s *ConnServer) Register(o Object) uint64
func (*ConnServer) RegisterBootstrap ¶
func (s *ConnServer) RegisterBootstrap(o Object)
func (*ConnServer) Serve ¶
func (s *ConnServer) Serve(ctx context.Context, c io.ReadWriteCloser)
func (*ConnServer) Wait ¶
func (s *ConnServer) Wait()
type ConnServerOptions ¶
type ConnServerOptions struct { MaxRequestSize uint64 // Each connection will stop reading new // requests if this is exceeded, zero // means unlimited. MaxOutstandingRequests uint64 // This function is used to create the root object // a client can send messages to. // // It takes a connection object as a way for out of band connection // information to be used while creating the root object. // One example is using a unix socket to get the remote user id, // and then using that for authentication. BootstrapFunc func(io.ReadWriteCloser) Object // If nil, defaults to DefaultRegistry Registry *Registry }
type Object ¶
type Object interface { Message(context.Context, *ConnServer, Message, RespondFunc) UnknownMessage(context.Context, *ConnServer, uint64, []byte, RespondFunc) Clunk(*ConnServer) }
type ObjectNotExist ¶
type ObjectNotExist struct{}
func (*ObjectNotExist) SropMarshal ¶
func (m *ObjectNotExist) SropMarshal() []byte
func (*ObjectNotExist) SropType ¶
func (m *ObjectNotExist) SropType() uint64
func (*ObjectNotExist) SropUnmarshal ¶
func (m *ObjectNotExist) SropUnmarshal(buf []byte) bool
type ObjectRef ¶
type ObjectRef struct {
Id uint64
}
func (*ObjectRef) SropMarshal ¶
func (*ObjectRef) SropUnmarshal ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
var DefaultRegistry *Registry
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) RegisterMessage ¶
type Request ¶
type RespondFunc ¶
type RespondFunc func(Message)
type Response ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(options ServerOptions) *Server
func (*Server) GoHandle ¶
func (s *Server) GoHandle(c io.ReadWriteCloser)
type ServerOptions ¶
type ServerOptions struct {
ConnOptions ConnServerOptions
}
type UnexpectedMessage ¶
type UnexpectedMessage struct{}
func (*UnexpectedMessage) SropMarshal ¶
func (m *UnexpectedMessage) SropMarshal() []byte
func (*UnexpectedMessage) SropType ¶
func (m *UnexpectedMessage) SropType() uint64
func (*UnexpectedMessage) SropUnmarshal ¶
func (m *UnexpectedMessage) SropUnmarshal(buf []byte) bool
Click to show internal directories.
Click to hide internal directories.