cmgr

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnKey

type ConnKey func(connection conn.Connection) string

the callback for getting connection key

type ConnectionManager

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

connection instances management

func NewManager

func NewManager(connKey ConnKey) *ConnectionManager

new connection manager instance you the conn key like this:

func getConnKey(conn conn.Connection) string {
	return conn.ConnectionState().Headers.Get("node_id")
}

func (*ConnectionManager) AddConnection

func (mgr *ConnectionManager) AddConnection(conn conn.Connection)

add connection into store

func (*ConnectionManager) DelConnection

func (mgr *ConnectionManager) DelConnection(conn conn.Connection)

delete connection from store

func (*ConnectionManager) GetConnection

func (mgr *ConnectionManager) GetConnection(key string) (conn.Connection, bool)

get connection for store

func (*ConnectionManager) Range

func (mgr *ConnectionManager) Range(f func(key, value interface{}) bool)

Jump to

Keyboard shortcuts

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