Documentation
¶
Index ¶
- func GetRegisterMethods(name string) ([]string, error)
- func NewService(opts ...Option) *service
- func Open(address string, ops ...netpoll.Option) (netpoll.EventLoop, error)
- func Register(rcvr any, name string, opts ...Option) error
- func SetRecoveryHandler(handle func(string, any))
- func Shutdown(eventLoop netpoll.EventLoop, timeout time.Duration)
- type AccessHandle
- type Dispatcher
- type GateAgent
- type Option
- type Options
- type SkynetContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRegisterMethods ¶
func NewService ¶
func NewService(opts ...Option) *service
func Register ¶
Register publishes uses the provided name in the dispatcher the set of methods of the receiver value that satisfy the following conditions:
- exported method of exported type
- two arguments, both of exported type
- the second argument is a pointer
- one return value, of type error
It returns an error if the receiver is not an exported type or has no suitable methods. It also logs the error using package log. The client accesses each method using a string of the form "Type.Method", where Type is the receiver's concrete type.
func SetRecoveryHandler ¶
By default, it will print the time and stack information of the error
Types ¶
type AccessHandle ¶
type AccessHandle func(ctx *SkynetContext, sname, method string, cost time.Duration, err error)
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
dispatcher represents an RPC disoatcher.
func GetDispatcher ¶
func GetDispatcher() *Dispatcher
func (*Dispatcher) DispatchReq ¶
type GateAgent ¶
type GateAgent struct { Reader chan netpoll.Reader // use for reader socker data // contains filtered or unexported fields }
func NewGateAgent ¶
func NewGateAgent(conn netpoll.Connection) *GateAgent
func (*GateAgent) ResponseErr ¶
func (*GateAgent) ResponseOk ¶
type Option ¶
type Option func(*Options)
func WithAccessLog ¶
func WithAccessLog(hdl AccessHandle) Option
func WithPayloadCodec ¶
func WithPayloadCodec(c codec.PayloadCodec) Option
type Options ¶
type Options struct { PayloadCodec codec.PayloadCodec AccessHdle AccessHandle }
type SkynetContext ¶
func NewSkynetContext ¶
func NewSkynetContext(ctx context.Context) *SkynetContext
Click to show internal directories.
Click to hide internal directories.