sbox

package module
v0.4.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 36 Imported by: 3

Documentation

Index

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) Clean

func (bch *BoxChannel) Clean()

Clean clean channel and reacover

func (*BoxChannel) Close

func (bch *BoxChannel) Close()

Close active close net channel !

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) Read

func (bch *BoxChannel) Read(pkg []byte, length int) (int, error)

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

func (*BoxChannel) Write

func (bch *BoxChannel) Write(pkg []byte, length int) (int, error)

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) Init

func (bn *BoxNetwork) Init()

Init init box net work

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) Stop

func (bn *BoxNetwork) Stop()

Stop stop box net work, send c

func (*BoxNetwork) Tick

func (bn *BoxNetwork) Tick()

Tick framework main loop

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 ConnectHandle func(string, string, string)

type HostInfo

type HostInfo struct {
	InnerHost  string `yaml:"host"`
	PublicHost string `yaml:"expose_host"`
}

type NetActionCallback

type NetActionCallback func(string, *BoxChannel, error)

NetActionCallback network event call back

type Option

type Option func(*Options)

func WithOsArgs

func WithOsArgs(args []string) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

func NewBoxOptions added in v0.4.13

func NewBoxOptions() *Options

func (*Options) GetOneHostIp

func (o *Options) GetOneHostIp() string

func (*Options) PreHosts added in v0.4.4

func (o *Options) PreHosts() error

type ProxyCallBack

type ProxyCallBack func(string, *BoxChannel, error) //get proxy call back

type ProxyFinder added in v0.4.4

type ProxyFinder func(uuid uint64, trans transport.ITransport) (idlrpc.IProxy, error)

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 SBoxKey

type SBoxKey struct{}

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) GetProxy

func (sb *ServiceBox) GetProxy(uuid uint64) (idlrpc.IProxy, error)

func (*ServiceBox) GetProxyFromPeer

func (sb *ServiceBox) GetProxyFromPeer(ctx context.Context, uuid uint64) (idlrpc.IProxy, error)

func (*ServiceBox) GetProxyWithNickName

func (sb *ServiceBox) GetProxyWithNickName(uuid uint64, name string) (idlrpc.IProxy, error)

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 ServiceCfg struct {
	//CustomName service nickname cache
	CustomName map[uint64]string `yaml:"custom_name"`
}

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 服务变化监听管理

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
net
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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL