peer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 12 Imported by: 0

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 CoreContextSet

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

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

func (*CoreContextSet) FetchContext

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

func (self *CorePeerProperty) NameOrAddress() 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) PostEvent

func (self *CoreProcBundle) PostEvent(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 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 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之前
	PostEvent(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