peer

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGenericPeer

func NewGenericPeer(peerType, name, addr string, q cellnet.EventQueue) cellnet.GenericPeer

创建Peer后,设置基本属性

func NewPeer

func NewPeer(peerType string) cellnet.Peer

创建一个Peer

func PeerCreatorList

func PeerCreatorList() (ret []string)

Peer创建器列表

func RegisterPeerCreator

func RegisterPeerCreator(f PeerCreateFunc)

注册Peer创建器

Types

type CoreCaptureIOPanic added in v0.0.3

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

func (*CoreCaptureIOPanic) CaptureIOPanic added in v0.0.3

func (self *CoreCaptureIOPanic) CaptureIOPanic() bool

func (*CoreCaptureIOPanic) EnableCaptureIOPanic added in v0.0.3

func (self *CoreCaptureIOPanic) EnableCaptureIOPanic(v bool)

type CoreContextSet

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

上下文记录,绑定用户自定义数据

func (*CoreContextSet) FetchContext added in v0.0.3

func (self *CoreContextSet) FetchContext(key, valuePtr interface{}) bool

func (*CoreContextSet) GetContext

func (self *CoreContextSet) GetContext(key interface{}) (interface{}, bool)

func (*CoreContextSet) SetContext

func (self *CoreContextSet) SetContext(key, v interface{})

type CorePeerProperty

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

func (*CorePeerProperty) Address

func (self *CorePeerProperty) Address() string

获取SetAddress中的侦听或者连接地址

func (*CorePeerProperty) Name

func (self *CorePeerProperty) Name() string

获取通讯端的名称

func (*CorePeerProperty) Queue

func (self *CorePeerProperty) Queue() cellnet.EventQueue

获取队列

func (*CorePeerProperty) SetAddress

func (self *CorePeerProperty) SetAddress(v string)

func (*CorePeerProperty) SetName

func (self *CorePeerProperty) SetName(v string)

func (*CorePeerProperty) SetQueue

func (self *CorePeerProperty) SetQueue(v cellnet.EventQueue)

type CoreProcBundle

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

func (*CoreProcBundle) GetBundle

func (self *CoreProcBundle) GetBundle() *CoreProcBundle

func (*CoreProcBundle) ProcEvent added in v0.0.3

func (self *CoreProcBundle) ProcEvent(ev cellnet.Event)

func (*CoreProcBundle) ReadMessage

func (self *CoreProcBundle) ReadMessage(ses cellnet.Session) (msg interface{}, err error)

func (*CoreProcBundle) SendMessage

func (self *CoreProcBundle) SendMessage(ev cellnet.Event)

func (*CoreProcBundle) SetCallback

func (self *CoreProcBundle) SetCallback(v cellnet.EventCallback)

func (*CoreProcBundle) SetHooker

func (self *CoreProcBundle) SetHooker(v cellnet.EventHooker)

func (*CoreProcBundle) SetTransmitter

func (self *CoreProcBundle) SetTransmitter(v cellnet.MessageTransmitter)

type CoreRedisParameter added in v0.0.3

type CoreRedisParameter struct {
	Password      string
	DBIndex       int
	PoolConnCount int
}

func (*CoreRedisParameter) Init added in v0.0.3

func (self *CoreRedisParameter) Init()

func (*CoreRedisParameter) SetConnectionCount added in v0.0.3

func (self *CoreRedisParameter) SetConnectionCount(v int)

func (*CoreRedisParameter) SetDBIndex added in v0.0.3

func (self *CoreRedisParameter) SetDBIndex(v int)

func (*CoreRedisParameter) SetPassword added in v0.0.3

func (self *CoreRedisParameter) SetPassword(v string)

type CoreRunningTag

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

通信通讯端共享的数据

func (*CoreRunningTag) EndStopping

func (self *CoreRunningTag) EndStopping()

func (*CoreRunningTag) IsRunning

func (self *CoreRunningTag) IsRunning() bool

func (*CoreRunningTag) IsStopping

func (self *CoreRunningTag) IsStopping() bool

func (*CoreRunningTag) SetRunning

func (self *CoreRunningTag) SetRunning(v bool)

func (*CoreRunningTag) StartStopping

func (self *CoreRunningTag) StartStopping()

func (*CoreRunningTag) WaitStopFinished

func (self *CoreRunningTag) WaitStopFinished()

type CoreSQLParameter added in v0.0.3

type CoreSQLParameter struct {
	PoolConnCount int
}

func (*CoreSQLParameter) Init added in v0.0.3

func (self *CoreSQLParameter) Init()

func (*CoreSQLParameter) SetConnectionCount added in v0.0.3

func (self *CoreSQLParameter) SetConnectionCount(v int)

func (*CoreSQLParameter) SetPassword added in v0.0.3

func (self *CoreSQLParameter) SetPassword(v string)

type CoreSessionIdentify

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

func (*CoreSessionIdentify) ID

func (self *CoreSessionIdentify) ID() int64

func (*CoreSessionIdentify) SetID

func (self *CoreSessionIdentify) SetID(id int64)

type CoreSessionManager

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

func (*CoreSessionManager) Add

func (self *CoreSessionManager) Add(ses cellnet.Session)

func (*CoreSessionManager) CloseAllSession

func (self *CoreSessionManager) CloseAllSession()

func (*CoreSessionManager) Count

func (self *CoreSessionManager) Count() int

func (*CoreSessionManager) GetSession

func (self *CoreSessionManager) GetSession(id int64) cellnet.Session

获得一个连接

func (*CoreSessionManager) Remove

func (self *CoreSessionManager) Remove(ses cellnet.Session)

func (*CoreSessionManager) SessionCount

func (self *CoreSessionManager) SessionCount() int

活跃的会话数量

func (*CoreSessionManager) SetIDBase

func (self *CoreSessionManager) SetIDBase(base int64)

func (*CoreSessionManager) VisitSession

func (self *CoreSessionManager) VisitSession(callback func(cellnet.Session) bool)

type CoreTCPSocketOption

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

func (*CoreTCPSocketOption) ApplySocketOption

func (self *CoreTCPSocketOption) ApplySocketOption(conn net.Conn)

func (*CoreTCPSocketOption) ApplySocketReadTimeout

func (self *CoreTCPSocketOption) ApplySocketReadTimeout(conn net.Conn, callback func())

func (*CoreTCPSocketOption) ApplySocketWriteTimeout

func (self *CoreTCPSocketOption) ApplySocketWriteTimeout(conn net.Conn, callback func())

func (*CoreTCPSocketOption) Init

func (self *CoreTCPSocketOption) Init()

func (*CoreTCPSocketOption) MaxPacketSize

func (self *CoreTCPSocketOption) MaxPacketSize() int

func (*CoreTCPSocketOption) SetMaxPacketSize

func (self *CoreTCPSocketOption) SetMaxPacketSize(maxSize int)

func (*CoreTCPSocketOption) SetSocketBuffer

func (self *CoreTCPSocketOption) SetSocketBuffer(readBufferSize, writeBufferSize int, noDelay bool)

func (*CoreTCPSocketOption) SetSocketDeadline

func (self *CoreTCPSocketOption) SetSocketDeadline(read, write time.Duration)

type MessagePoster

type MessagePoster interface {

	// 投递一个消息到Hooker之前
	ProcEvent(ev cellnet.Event)
}

手动投递消息, 兼容v2的设计

type PeerCreateFunc

type PeerCreateFunc func() cellnet.Peer

type SessionManager

type SessionManager interface {
	cellnet.SessionAccessor

	Add(cellnet.Session)
	Remove(cellnet.Session)
	Count() int

	// 设置ID开始的号
	SetIDBase(base int64)
}

完整功能的会话管理

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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