Documentation ¶
Index ¶
- Constants
- type BoxChannel
- func (bch *BoxChannel) Clean()
- func (bch *BoxChannel) Close()
- func (bch *BoxChannel) GetID() uint32
- func (bch *BoxChannel) GlobalIndex() protocol.GlobalIndexType
- func (bch *BoxChannel) IsClose() bool
- func (bch *BoxChannel) LocalAddr() string
- func (bch *BoxChannel) Peek(length int) ([]byte, int, error)
- func (bch *BoxChannel) Read(pkg []byte, length int) (int, error)
- func (bch *BoxChannel) RemoteAddr() string
- func (bch *BoxChannel) Send(pkg []byte) error
- func (bch *BoxChannel) SetGlobalIndex(uuid protocol.GlobalIndexType)
- func (bch *BoxChannel) SetID(transID uint32)
- func (bch *BoxChannel) Size() uint32
- func (bch *BoxChannel) Write(pkg []byte, length int) (int, error)
- type BoxNetwork
- func (bn *BoxNetwork) ConnectTo(network, address string) (net.IBoxConn, error)
- func (bn *BoxNetwork) ConnectToService(service, network, address string)
- func (bn *BoxNetwork) Init()
- func (bn *BoxNetwork) ListenAt(network, address string) error
- func (bn *BoxNetwork) RegisterEventHandle(eventType net.EventType, handle NetActionCallback)
- func (bn *BoxNetwork) Start()
- func (bn *BoxNetwork) Stop()
- func (bn *BoxNetwork) Tick()
- func (bn *BoxNetwork) TryGetChannel(host string) *BoxChannel
- type ChannelCache
- type ConnectHandle
- type HostInfo
- type NetActionCallback
- type Option
- type Options
- type ProxyCallBack
- type ProxyFinder
- type ProxyHandler
- type SBoxKey
- type ServiceBox
- func (sb *ServiceBox) AddServicePackage(pack *idlrpc.PackageInfo) error
- func (sb *ServiceBox) GetConfig() config.Config
- func (sb *ServiceBox) GetHttp() *http_proxy.HttpProxy
- func (sb *ServiceBox) GetLogger() slog.BoxLogger
- func (sb *ServiceBox) GetMongoClient() *mongodb.MongoDB
- func (sb *ServiceBox) GetOptions() string
- func (sb *ServiceBox) GetProxy(uuid uint64) (idlrpc.IProxy, error)
- func (sb *ServiceBox) GetProxyFromPeer(ctx context.Context, uuid uint64) (idlrpc.IProxy, error)
- func (sb *ServiceBox) GetProxyWithNickName(uuid uint64, name string) (idlrpc.IProxy, error)
- func (sb *ServiceBox) GetRedisClient() redis.IClient
- func (sb *ServiceBox) GetTransport(uuid uint64) (*BoxChannel, error)
- func (sb *ServiceBox) Init(opts ...Option) error
- func (sb *ServiceBox) ShutDown() error
- func (sb *ServiceBox) Start() error
- func (sb *ServiceBox) Tick()
- func (sb *ServiceBox) UnWatchService(name string, watcher ServiceWatcher) error
- func (sb *ServiceBox) WatchService(uuid uint64, watcher ServiceWatcher) error
- func (sb *ServiceBox) WatchServiceWithNickName(uuid uint64, name string, watcher ServiceWatcher) error
- type ServiceCfg
- type ServiceEvent
- type ServiceWatcher
- type WatcherList
- type WatcherManager
Constants ¶
View Source
const ( ServiceAdd = iota ServiceClose )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoxChannel ¶
type BoxChannel struct {
// contains filtered or unexported fields
}
BoxChannel implement rpc backend go transport interface one connect has it's own channel
func NewBoxChannel ¶
func NewBoxChannel(conn net.IBoxConn) *BoxChannel
func (*BoxChannel) GetID ¶
func (bch *BoxChannel) GetID() uint32
func (*BoxChannel) GlobalIndex ¶
func (bch *BoxChannel) GlobalIndex() protocol.GlobalIndexType
func (*BoxChannel) IsClose ¶
func (bch *BoxChannel) IsClose() bool
func (*BoxChannel) LocalAddr ¶
func (bch *BoxChannel) LocalAddr() string
func (*BoxChannel) Peek ¶
func (bch *BoxChannel) Peek(length int) ([]byte, int, error)
Peek read buffer without modify read point
func (*BoxChannel) RemoteAddr ¶
func (bch *BoxChannel) RemoteAddr() string
func (*BoxChannel) Send ¶
func (bch *BoxChannel) Send(pkg []byte) error
func (*BoxChannel) SetGlobalIndex ¶
func (bch *BoxChannel) SetGlobalIndex(uuid protocol.GlobalIndexType)
func (*BoxChannel) SetID ¶
func (bch *BoxChannel) SetID(transID uint32)
func (*BoxChannel) Size ¶
func (bch *BoxChannel) Size() uint32
type BoxNetwork ¶
type BoxNetwork struct {
// contains filtered or unexported fields
}
BoxNetwork service box network manager
func NewBoxNetWork ¶
func NewBoxNetWork() *BoxNetwork
func (*BoxNetwork) ConnectTo ¶
func (bn *BoxNetwork) ConnectTo(network, address string) (net.IBoxConn, error)
ConnectTo connect to other server block
func (*BoxNetwork) ConnectToService ¶
func (bn *BoxNetwork) ConnectToService(service, network, address string)
func (*BoxNetwork) ListenAt ¶
func (bn *BoxNetwork) ListenAt(network, address string) error
ListenAt start Server at address !
func (*BoxNetwork) RegisterEventHandle ¶
func (bn *BoxNetwork) RegisterEventHandle(eventType net.EventType, handle NetActionCallback)
func (*BoxNetwork) Start ¶
func (bn *BoxNetwork) Start()
Start start all box network loop, like redis, zookeeper
func (*BoxNetwork) TryGetChannel ¶ added in v0.4.7
func (bn *BoxNetwork) TryGetChannel(host string) *BoxChannel
type ChannelCache ¶
type ChannelCache map[string]*BoxChannel
ChannelCache LoopCache map[string]*boxNetLoop
type ConnectHandle ¶ added in v0.4.4
type NetActionCallback ¶
type NetActionCallback func(string, *BoxChannel, error)
NetActionCallback network event call back
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func NewBoxOptions ¶ added in v0.4.13
func NewBoxOptions() *Options
func (*Options) GetOneHostIp ¶
type ProxyCallBack ¶
type ProxyCallBack func(string, *BoxChannel, error) //get proxy call back
type ProxyFinder ¶ added in v0.4.4
ProxyFinder 服务proxy获取接口
type ProxyHandler ¶
type ProxyHandler struct {
// contains filtered or unexported fields
}
func (*ProxyHandler) NewReplaceID ¶
func (p *ProxyHandler) NewReplaceID() uint32
func (*ProxyHandler) OnRelay ¶
func (p *ProxyHandler) OnRelay(from transport.ITransport, header *protocol.RpcMsgHeader) error
type ServiceBox ¶
type ServiceBox struct {
// contains filtered or unexported fields
}
func MakeServiceBox ¶
func MakeServiceBox() *ServiceBox
func (*ServiceBox) AddServicePackage ¶
func (sb *ServiceBox) AddServicePackage(pack *idlrpc.PackageInfo) error
func (*ServiceBox) GetConfig ¶
func (sb *ServiceBox) GetConfig() config.Config
func (*ServiceBox) GetHttp ¶ added in v0.4.19
func (sb *ServiceBox) GetHttp() *http_proxy.HttpProxy
GetHttp 返回http模块,需要配置中开启http模块,并且以网关模式启动plato应用
func (*ServiceBox) GetLogger ¶
func (sb *ServiceBox) GetLogger() slog.BoxLogger
func (*ServiceBox) GetMongoClient ¶ added in v0.4.2
func (sb *ServiceBox) GetMongoClient() *mongodb.MongoDB
func (*ServiceBox) GetOptions ¶
func (sb *ServiceBox) GetOptions() string
func (*ServiceBox) GetProxyFromPeer ¶
func (*ServiceBox) GetProxyWithNickName ¶
func (*ServiceBox) GetRedisClient ¶ added in v0.4.2
func (sb *ServiceBox) GetRedisClient() redis.IClient
func (*ServiceBox) GetTransport ¶
func (sb *ServiceBox) GetTransport(uuid uint64) (*BoxChannel, error)
func (*ServiceBox) Init ¶
func (sb *ServiceBox) Init(opts ...Option) error
func (*ServiceBox) ShutDown ¶
func (sb *ServiceBox) ShutDown() error
func (*ServiceBox) Start ¶
func (sb *ServiceBox) Start() error
func (*ServiceBox) Tick ¶
func (sb *ServiceBox) Tick()
func (*ServiceBox) UnWatchService ¶ added in v0.4.4
func (sb *ServiceBox) UnWatchService(name string, watcher ServiceWatcher) error
func (*ServiceBox) WatchService ¶ added in v0.4.4
func (sb *ServiceBox) WatchService(uuid uint64, watcher ServiceWatcher) error
func (*ServiceBox) WatchServiceWithNickName ¶ added in v0.4.4
func (sb *ServiceBox) WatchServiceWithNickName(uuid uint64, name string, watcher ServiceWatcher) error
type ServiceCfg ¶
type ServiceEvent ¶ added in v0.4.4
type ServiceEvent int
ServiceEvent 服务变化事件类型 ServiceAdd 添加 ServiceClose 关闭
type ServiceWatcher ¶ added in v0.4.4
type ServiceWatcher func(eType ServiceEvent, name string, host string, proxy idlrpc.IProxy)
ServiceWatcher 是服务监听回调函数类型
type WatcherList ¶ added in v0.4.4
type WatcherList struct {
// contains filtered or unexported fields
}
type WatcherManager ¶ added in v0.4.4
type WatcherManager struct {
// contains filtered or unexported fields
}
WatcherManager 服务变化监听管理
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package common some common define
|
Package common some common define |
example
|
|
testcallee
Generated by the go idl tools.
|
Generated by the go idl tools. |
testcaller
Generated by the go idl tools.
|
Generated by the go idl tools. |
internal
|
|
util
|
|
config/loader/memory
Package memory loader will load config info from source, encoder it and store to memory
|
Package memory loader will load config info from source, encoder it and store to memory |
Click to show internal directories.
Click to hide internal directories.