forked from aceld/zinx
/
iconnmanager.go
20 lines (19 loc) · 1.38 KB
/
iconnmanager.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// @Title iconnmanager.go
// @Description Connection management related operations, including adding, removing, getting a connection object by a connection ID, methods to get the current number of connections and clear all connections.
// @Author Aceld - Thu Mar 11 10:32:29 CST 2019
package ziface
/*
IConnManager Connection Management Abstract Layer
*/
type IConnManager interface {
Add(IConnection) // Add connection
Remove(IConnection) // Remove connection
Get(uint64) (IConnection, error) // Get a connection by ConnID
Get2(string) (IConnection, error) // Get a connection by string ConnID
Len() int // Get current number of connections
ClearConn() // Remove and stop all connections
GetAllConnID() []uint64 // Get all connection IDs
GetAllConnIdStr() []string // Get all string connection IDs
Range(func(uint64, IConnection, interface{}) error, interface{}) error // Traverse all connections
Range2(func(string, IConnection, interface{}) error, interface{}) error // Traverse all connections 2
}