Documentation ¶
Index ¶
- Constants
- func AppName() string
- func BytesToUint32(buf []byte) uint32
- func GetListener(ipPort string) net.Listener
- func GoDone(num int, fun GoFun)
- func GoMustBeLaunch(fun GoLaunchFun, args ...interface{})
- func GoSelect(num int, fun GoSelectFun, goCall bool, c chan interface{})
- func IsBigEndian() bool
- func Json2Ojb(jsonStr string, data interface{}) bool
- func JsonStrEuqal(str1, str2 string) bool
- func ListenerEnableTLS(listener net.Listener, tlsCfg *TlsCfg) net.Listener
- func Map2Struct(data interface{}, obj interface{}) error
- func Obj2Json(obj interface{}, pretty bool) string
- func PoolSetByte(orgBytes []byte)
- func RandInt(max int) uint32
- func Struct2Map(obj interface{}) map[string]interface{}
- func Uint32InBytes(v uint32, b []byte)
- func Uint32ToBytes(i uint32) []byte
- type BaseCliCb
- type BaseSerCb
- type ConnStat
- type Event
- type EventDispatcher
- type EventListener
- type GoFun
- type GoLaunchFun
- type GoSelectFun
- type PingPongStat
- type TcpBase
- type TcpCli
- type TcpNBase
- func (tcp *TcpNBase) AuthOut(connId string)
- func (tcp *TcpNBase) Close()
- func (tcp *TcpNBase) CloseAllConns()
- func (tcp *TcpNBase) ConIdByIp(ip string) (string, error)
- func (tcp *TcpNBase) ConnByIp(ip string) *TcpBase
- func (tcp *TcpNBase) ConnRemove(connIp string)
- func (tcp *TcpNBase) ConnRemoveByConnId(connId string)
- func (tcp *TcpNBase) HeartBeatSecond() int
- func (tcp *TcpNBase) SendAllConns(bytes []byte)
- func (tcp *TcpNBase) SendWithConn(connId string, bytes []byte)
- func (tcp *TcpNBase) SendWithIp(connIp string, bytes []byte)
- func (tcp *TcpNBase) SetConnId(ip, connId string)
- type TcpSer
- type TlsCfg
Constants ¶
View Source
const ( KGlogLevel = 3 KConnTimeoutSeconds = 3 )
View Source
const ( ReadOK = iota ReadError ReadTimeOut KReplyStatSendSuc KReplyStatSendTimeOut KReplyStatPingTimeOut KReplyStatPongTimeOut )
View Source
const ( StateChangeEventType = "stateChange" LeaderChangeEventType = "leaderChange" TermChangeEventType = "termChange" CommitEventType = "commit" AddPeerEventType = "addPeer" RemovePeerEventType = "removePeer" HeartbeatIntervalEventType = "heartbeatInterval" ElectionTimeoutThresholdEventType = "electionTimeoutThreshold" HeartbeatEventType = "heartbeat" )
Variables ¶
This section is empty.
Functions ¶
func BytesToUint32 ¶
func GetListener ¶
func GoMustBeLaunch ¶
func GoMustBeLaunch(fun GoLaunchFun, args ...interface{})
func GoSelect ¶
func GoSelect(num int, fun GoSelectFun, goCall bool, c chan interface{})
func IsBigEndian ¶
func IsBigEndian() bool
func JsonStrEuqal ¶
func Map2Struct ¶
func Map2Struct(data interface{}, obj interface{}) error
Struct Att MUST be CanSet. Big prefix
func PoolSetByte ¶
func PoolSetByte(orgBytes []byte)
func Struct2Map ¶
func Struct2Map(obj interface{}) map[string]interface{}
Struct Att MUST be CanSet. Big prefix
func Uint32InBytes ¶
func Uint32ToBytes ¶
Types ¶
type Event ¶
type Event interface { Type() string Source() interface{} Value() interface{} PrevValue() interface{} }
Event represents an action that occurred within the Raft library. Listeners can subscribe to event types by using the Server.AddEventListener() function.
type EventDispatcher ¶
EventDispatcher is responsible for managing listeners for named events and dispatching event notifications to those listeners.
func NewEventDispatcher ¶
func NewEventDispatcher(source interface{}) *EventDispatcher
newEventDispatcher creates a new EventDispatcher instance.
func (*EventDispatcher) AddEventListener ¶
func (d *EventDispatcher) AddEventListener(typ string, listener EventListener)
AddEventListener adds a listener function for a given event type.
func (*EventDispatcher) DispatchEvent ¶
func (d *EventDispatcher) DispatchEvent(e Event)
DispatchEvent dispatches an event.
func (*EventDispatcher) RemoveEventListener ¶
func (d *EventDispatcher) RemoveEventListener(typ string, listener EventListener)
RemoveEventListener removes a listener function for a given event type.
type EventListener ¶
type EventListener func(Event)
EventListener is a function that can receive event notifications.
type GoLaunchFun ¶
type GoLaunchFun func(args ...interface{})
type GoSelectFun ¶
type GoSelectFun func(args interface{})
type PingPongStat ¶
type PingPongStat int
type TcpBase ¶
type TcpBase struct { PPStat PingPongStat // contains filtered or unexported fields }
func NewTcpBase ¶
type TcpCli ¶
type TcpCli struct { TcpNBase // contains filtered or unexported fields }
func (*TcpCli) ConnRemove ¶
func (*TcpCli) SendByHash ¶
type TcpNBase ¶
type TcpNBase struct { sync.RWMutex Tag int ConnCount uint32 // contains filtered or unexported fields }
func (*TcpNBase) CloseAllConns ¶
func (tcp *TcpNBase) CloseAllConns()
func (*TcpNBase) ConnRemove ¶
func (*TcpNBase) ConnRemoveByConnId ¶
func (*TcpNBase) HeartBeatSecond ¶
func (*TcpNBase) SendAllConns ¶
func (*TcpNBase) SendWithConn ¶
func (*TcpNBase) SendWithIp ¶
Click to show internal directories.
Click to hide internal directories.