Versions in this module Expand all Collapse all v0 v0.0.9 Jan 24, 2024 v0.0.3 Jan 24, 2024 Changes in this version + var EmptyContext = (IRpcContext)((*rpcContext)(nil)) + var ErrNodeMessageChanFull = fmt.Errorf("note message chan full") + var ErrRemoteDisconnected = fmt.Errorf("remote disconnected") + var ErrRequestTimeoutLocal = fmt.Errorf("session timeout from local") + var ErrRequestTimeoutRemote = fmt.Errorf("session timeout from remote") + var ErrServiceNotExist = fmt.Errorf("service not exist") + var NodeAddrInvalid = NodeAddr(-1) + var NodeAddrLocal = NodeAddr(0) + var NodeConfig = &NodeConfigStruct + func AddNode(b host.IBuilder, registerFactory func() *NodeExOption) + func InitOptions(opt *NodeBootOption) + func NewService(name string) (int32, error) + func StartService(saddr int32, arg interface{}) bool + func StopService(saddr int32) bool + type INodeAddr interface + GetIPString func() string + IsLocalhost func() bool + String func() string + type IPromise interface + Catch func(f func(error)) IPromise + Done func() + Final func(f func()) IPromise + Then func(f interface{}) IPromise + Timeout func(timeout time.Duration) IPromise + type IProxy interface + AddBuffer func(n int, fullcb func()) + Avail func() bool + Call func(fname string, args ...interface{}) IPromise + GetNodeAddr func() INodeAddr + Reset func(proxy IProxy) + type IRpcContext interface + Error func(error) + GetRemoteNodeAddr func() INodeAddr + GetRemoteServiceAddr func() int32 + Return func(args ...interface{}) + type ITimer interface + Set func(interval, delay time.Duration, f func()) + SetDelay func(delay time.Duration) + SetFunc func(f func()) + SetInterval func(interval time.Duration) + Start func() + Stop func() + type Node struct + func (ss *Node) Construct(host host.IHost, logger *logging.Logger[Node], ...) + func (ss *Node) Start(ctx context.Context, wg *sync2.TimeoutWaitGroup) + func (ss *Node) Stop(ctx context.Context, wg *sync2.TimeoutWaitGroup) + type NodeAddr int64 + func NewNodeAddr(host string, port int) (NodeAddr, error) + func (ss NodeAddr) GetIPString() string + func (ss NodeAddr) IsLocalhost() bool + func (ss NodeAddr) String() string + type NodeAddrUpdater struct + func NewNodeAddrUpdater(naddr NodeAddr, updateFunc func(chan<- *NodeAddr)) *NodeAddrUpdater + func (ss *NodeAddrUpdater) GetNodeAddr() NodeAddr + func (ss *NodeAddrUpdater) Start() + type NodeBootOption struct + BootName string + Nodes map[string]*nodeElementOption + type NodeConfigStruct struct + CurNode []string + CurNodeAddr NodeAddr + CurNodeMap map[string]bool + CurNodePort int + Nodes []*nodeInfo + type NodeExOption struct + ClientHandlePreprocessor net2.IPreprocessor + ServerHandlePreprocessor net2.IPreprocessor + ServiceRegisterInfos []*ServiceRegisterInfo + type Service struct + MethodMap map[string]reflect.Value + func (ss *Service) After(delay time.Duration, f func()) ITimer + func (ss *Service) Construct(logger *logging.Logger[Service]) + func (ss *Service) CreateProxy(name string) IProxy + func (ss *Service) CreateProxyByNodeAddr(naddr INodeAddr, saddr int32) IProxy + func (ss *Service) CreateProxyByNodeKind(naddr INodeAddr, name string) IProxy + func (ss *Service) CreateProxyByUpdaterAddr(naddrUpdater *NodeAddrUpdater, saddr int32) IProxy + func (ss *Service) CreateProxyByUpdaterKind(naddrUpdater *NodeAddrUpdater, name string) IProxy + func (ss *Service) CreateProxyDefault() IProxy + func (ss *Service) Debugf(format string, args ...any) + func (ss *Service) EnableRPC() + func (ss *Service) Entry(ctx IRpcContext, funcName string, ...) func() + func (ss *Service) Errorf(format string, args ...any) + func (ss *Service) Fatalf(format string, args ...any) + func (ss *Service) Fork(tag string, f func()) + func (ss *Service) GetAddr() int32 + func (ss *Service) GetKind() int32 + func (ss *Service) GetLoad() float64 + func (ss *Service) GetMillisecond() int64 + func (ss *Service) GetName() string + func (ss *Service) GetSecond() int64 + func (ss *Service) GetTime() time.Time + func (ss *Service) Infof(format string, args ...any) + func (ss *Service) NewService(name string) (int32, error) + func (ss *Service) RpcReload(ctx IRpcContext) + func (ss *Service) RpcStatus(ctx IRpcContext) + func (ss *Service) SetAllowedRPC(names []string) + func (ss *Service) Start(_ interface{}) + func (ss *Service) Stop(_ *sync.WaitGroup) + func (ss *Service) Tick(interval, delay time.Duration, f func()) ITimer + func (ss *Service) TickAfter(interval time.Duration, f func(func())) ITimer + func (ss *Service) TickDelayRandom(interval time.Duration, f func()) ITimer + func (ss *Service) Tracef(format string, args ...any) + func (ss *Service) Warnf(format string, args ...any) + type ServiceRegisterInfo struct + Kind int32 + Name string + Type any + type TagFunc struct + F func() + Tag string