Documentation ¶
Index ¶
- type Conn
- func (c *Conn) Close()
- func (c *Conn) GetIDLock() string
- func (c *Conn) LogLock(level dshardorchestrator.LogLevel, err error, msg string)
- func (c *Conn) Run()
- func (c *Conn) Send(evtID dshardorchestrator.EventType, body interface{}, queueFailed bool) error
- func (c *Conn) SendLogErr(evtID dshardorchestrator.EventType, body interface{}, queueFailed bool)
- type Interface
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { NodeID string // contains filtered or unexported fields }
Conn represents a connection to the orchestrator
func ConnectToOrchestrator ¶
func ConnectToOrchestrator(bot Interface, addr string, nodeVersion string, id string, logger dshardorchestrator.Logger) (*Conn, error)
ConnectToOrchestrator attempts to connect to master, if it fails it will launch a reconnect loop and wait until the master appears
func NewNodeConn ¶
func NewNodeConn(bot Interface, addr string, nodeVersion string, id string, logger dshardorchestrator.Logger) *Conn
NewNodeConn returns a new node connection
func (*Conn) LogLock ¶
func (c *Conn) LogLock(level dshardorchestrator.LogLevel, err error, msg string)
func (*Conn) Send ¶
func (c *Conn) Send(evtID dshardorchestrator.EventType, body interface{}, queueFailed bool) error
Send sends the message to the master, if the connection is closed it will queue the message if queueFailed is set
func (*Conn) SendLogErr ¶
func (c *Conn) SendLogErr(evtID dshardorchestrator.EventType, body interface{}, queueFailed bool)
type Interface ¶
type Interface interface { SessionEstablished(info SessionInfo) // StopShard should disconnect the specific shard, and return the session info for resumes StopShard(shard int) (sessionID string, sequence int64) // ResumeShard should resume the speficic shard ResumeShard(shard int, sessionID string, sequence int64) // AddNewShards should add the following new shards to this node, doing the complete identify flow AddNewShards(shards ...int) // Caled when the bot should shut down, make sure to send EvtShutdown when completed Shutdown() // InitializeShardTransferFrom should prepare the shard for a outgoing transfer to another node, disconnecting it and returning the session info InitializeShardTransferFrom(shard int) (sessionID string, sequence int64) // InitializeShardTransferTo should prepare for a incoming shard transfer, ResumeShard is called aswell so this is not needed in most cases InitializeShardTransferTo(shard int, sessionID string, sequence int64) // StartShardTransferFrom should return when all user events has been sent, with the number of user events sent StartShardTransferFrom(shard int) (numEventsSent int) // HandleUserEvent should handle a user event, most commonly used for migrating data between shards during transfers HandleUserEvent(evt dshardorchestrator.EventType, data interface{}) }
type SessionInfo ¶
type SessionInfo struct {
TotalShards int
}
Click to show internal directories.
Click to hide internal directories.