dht

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CisNull          = iota // null, not inited
	CisConnecting           // connecting
	CisConnected            // connected
	CisAccepted             // accepted
	CisInHandshaking        // handshaking
	CisHandshook            // handshook
	CisInService            // in service
	CisOutOfService         // out of service but is not closed
	CisClosed               // closed
)

Connection instance status

View Source
const (
	ConInstDirInbound  = 0  // out from local
	ConInstDirOutbound = 1  // in from peer
	ConInstDirAllbound = 2  // in & out
	ConInstDirUnknown  = -1 // not be initialized
)

Connection instance direction

View Source
const (
	DsGVBS_NULL = iota
	DsGVBS_WORKING
	DsGVBS_KILLING
)

batch-get

View Source
const (
	PID_DHT = pb.ProtocolId_PID_DHT // dht internal
	PID_EXT = pb.ProtocolId_PID_EXT // external, for dht users
)

Protocol identity

View Source
const (
	MID_HANDSHAKE       = 0
	MID_FINDNODE        = 1
	MID_NEIGHBORS       = 2
	MID_PUTVALUE        = 3
	MID_GETVALUE_REQ    = 4
	MID_GETVALUE_RSP    = 5
	MID_PUTPROVIDER     = 6
	MID_GETPROVIDER_REQ = 7
	MID_GETPROVIDER_RSP = 8
	MID_PING            = 9
	MID_PONG            = 10
	MID_UNKNOWN         = 0xffffffff
)

Message type identity

View Source
const (
	QryMgrName        = sch.DhtQryMgrName // query manage name registered in shceduler
	QryMgrMailboxSize = 1024 * 128        // mail box size

)

Constants

View Source
const (
	RutMgrName = sch.DhtRutMgrName // Route manager name registered in scheduler

	HashByteLength = config.DhtKeyLength // 32 bytes(256 bits) hash applied
	HashBitLength  = HashByteLength * 8  // hash bits

)

Constants

View Source
const (
	TmEnoNone        timerEno = iota // none of errors
	TmEnoPara                        // invalid parameters
	TmEnoDurTooBig                   // duration too big
	TmEnoDurTooSmall                 // duration too small
	TmEnoInternal                    // internal errors
	TmEnoBadTimer                    // bad timer parameters
)
View Source
const ConMgrMailboxSize = 1024 * 16
View Source
const ConMgrName = sch.DhtConMgrName

Connection manager name registered in scheduler

View Source
const DhtMgrName = sch.DhtMgrName

Dht manager name registered in scheduler

View Source
const DhtProtoBytes = 4

Protocol

View Source
const DsKeyLength = config.DhtKeyLength

Datastore key

View Source
const DsMgrDurInf = time.Duration(0)

infinite

View Source
const DsMgrMailboxSize = 1024 * 16
View Source
const DsMgrName = sch.DhtDsMgrName

Data store manager name registered in scheduler

View Source
const LsnMgrName = sch.DhtLsnMgrName

Listener manager name registered in scheduler

View Source
const (
	OneTick = oneTick
)
View Source
const PrdMgrName = sch.DhtPrdMgrName

Provider manager name registered in scheduler

Variables

View Source
var DhtVersion = [DhtProtoBytes]byte{1, 0, 0, 0}

Functions

func CloseChConMgrReady

func CloseChConMgrReady(name string)

func ConMgrReady

func ConMgrReady(name string) bool

func DhtReady

func DhtReady(inst string) bool

dht ready

func GetNumberOfBucketNode

func GetNumberOfBucketNode(sdl string) int

func GetQuerySeqNo

func GetQuerySeqNo(name string) int64

func SetBootstrapNodes

func SetBootstrapNodes(bsn []*config.Node, nname string)

func SetChConMgrReady

func SetChConMgrReady(name string, ch chan bool)

Types

type ConInst

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

Dht connection instance

func (*ConInst) GetScheduler

func (conInst *ConInst) GetScheduler() *sch.Scheduler

Get scheduler

func (*ConInst) InstallRxDataCallback

func (conInst *ConInst) InstallRxDataCallback(cbf ConInstRxDataCallback) DhtErrno

Install callback for rx data with protocol identity PID_EXT

func (*ConInst) TaskProc4Scheduler

func (conInst *ConInst) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type ConInstDir

type ConInstDir = int

type ConInstRxDataCallback

type ConInstRxDataCallback func(conInst interface{}, pid uint32, msg interface{}) int

Call back type for rx data of protocols than PID_DHT

type ConMgr

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

func NewConMgr

func NewConMgr() *ConMgr

Create route manager

func (*ConMgr) IsBusy

func (conMgr *ConMgr) IsBusy() bool

func (*ConMgr) TaskProc4Scheduler

func (conMgr *ConMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type Datastore

type Datastore interface {
	Put(key []byte, value DsValue, kt time.Duration) DhtErrno

	Get(key []byte) (eno DhtErrno, value DsValue)

	Delete(key []byte) DhtErrno

	Close() DhtErrno
}

Common datastore interface

type DhtCallback

type DhtCallback func(mgr interface{}, mid int, msg interface{}) int

Callback type

type DhtDatastoreRecord

type DhtDatastoreRecord struct {
	Key   []byte // key
	Value []byte // value
	Extra []byte // extra info
}

Data store (key, value) record

func (*DhtDatastoreRecord) DecDsRecord

func (dhtDsRec *DhtDatastoreRecord) DecDsRecord(dsr *DsRecord) DhtErrno

Decode data store (key, value) record

func (*DhtDatastoreRecord) EncDsRecord

func (dhtDsRec *DhtDatastoreRecord) EncDsRecord(dsr *DsRecord) DhtErrno

Encode data store (key, value) record

type DhtErrno

type DhtErrno int

errno for route manager

const (
	DhtEnoNone          DhtErrno = iota // none of errors
	DhtEnoParameter                     // invalid parameters
	DhtEnoScheduler                     // scheduler errors
	DhtEnoNotFound                      // something not found
	DhtEnoDuplicated                    // something duplicated
	DhtEnoMismatched                    // status mismatched
	DhtEnoResource                      // no more resource
	DhtEnoRoute                         // route errors
	DhtEnoTimeout                       // timeout
	DhtEnoInternal                      // internal logical errors
	DhtEnoOs                            // underlying operating system errors
	DhtEnoSerialization                 // serialization errors
	DhtEnoProtocol                      // protocol errors
	DhtEnoNotSup                        // not supported
	DhtEnoDatastore                     // data store errors
	DhtEnoTimer                         // timer errors
	DhtEnoBootstrapNode                 // bootstarp node related
	DhtEnoNatMapping                    // casued by nat mapping
	DhtEnoUnknown                       // unknown
)

func (DhtErrno) Error

func (eno DhtErrno) Error() string

func (DhtErrno) GetEno

func (eno DhtErrno) GetEno() int

type DhtKey

type DhtKey = []byte

Value

type DhtMessage

type DhtMessage struct {
	Mid            uint32          // message identity
	Handshake      *Handshake      // handshake message
	FindNode       *FindNode       // find node message
	Neighbors      *Neighbors      // neighbors message
	PutValue       *PutValue       // put value message
	GetValueReq    *GetValueReq    // get value request message
	GetValueRsp    *GetValueRsp    // get value response message
	PutProvider    *PutProvider    // put provider message
	GetProviderReq *GetProviderReq // get provider request message
	GetProviderRsp *GetProviderRsp // get provider response message
	Ping           *Ping           // ping message
	Pong           *Pong           // pong message
}

Message for DHT protocol

func (*DhtMessage) GetFindNodeMessage

func (dhtMsg *DhtMessage) GetFindNodeMessage(pbMsg *pb.DhtMessage_FindNode) DhtErrno

Setup dht find-node message from protobuf message

func (*DhtMessage) GetFindNodePackage

func (dhtMsg *DhtMessage) GetFindNodePackage(dhtPkg *DhtPackage) DhtErrno

Setup dht find-node package from dht message

func (*DhtMessage) GetGetProviderReqMessage

func (dhtMsg *DhtMessage) GetGetProviderReqMessage(pbMsg *pb.DhtMessage_GetProviderReq) DhtErrno

Setup dht get-provider-req message from protobuf message

func (*DhtMessage) GetGetProviderReqPackage

func (dhtMsg *DhtMessage) GetGetProviderReqPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht get-provider-req package from dht message

func (*DhtMessage) GetGetProviderRspMessage

func (dhtMsg *DhtMessage) GetGetProviderRspMessage(pbMsg *pb.DhtMessage_GetProviderRsp) DhtErrno

Setup dht get-provider-rsp message from protobuf message

func (*DhtMessage) GetGetProviderRspPackage

func (dhtMsg *DhtMessage) GetGetProviderRspPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht get-provider-rsp package from dht message

func (*DhtMessage) GetGetValueReqMessage

func (dhtMsg *DhtMessage) GetGetValueReqMessage(pbMsg *pb.DhtMessage_GetValueReq) DhtErrno

Setup dht get-value-req message from protobuf message

func (*DhtMessage) GetGetValueReqPackage

func (dhtMsg *DhtMessage) GetGetValueReqPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht get-value-req package from dht message

func (*DhtMessage) GetGetValueRspMessage

func (dhtMsg *DhtMessage) GetGetValueRspMessage(pbMsg *pb.DhtMessage_GetValueRsp) DhtErrno

Setup dht get-value-rsp message from protobuf message

func (*DhtMessage) GetGetValueRspPackage

func (dhtMsg *DhtMessage) GetGetValueRspPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht get-value-rsp package from dht message

func (*DhtMessage) GetHandshakeMessage

func (dhtMsg *DhtMessage) GetHandshakeMessage(pbMsg *pb.DhtMessage_Handshake) DhtErrno

Setup dht handshake message from protobuf message

func (*DhtMessage) GetHandshakePackage

func (dhtMsg *DhtMessage) GetHandshakePackage(dhtPkg *DhtPackage) DhtErrno

Setup dht handshake package from dht message

func (*DhtMessage) GetNeighborsMessage

func (dhtMsg *DhtMessage) GetNeighborsMessage(pbMsg *pb.DhtMessage_Neighbors) DhtErrno

Setup dht neighbors message from protobuf message

func (*DhtMessage) GetNeighborsPackage

func (dhtMsg *DhtMessage) GetNeighborsPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht neighbors package from dht message

func (*DhtMessage) GetPackage

func (dhtMsg *DhtMessage) GetPackage(dhtPkg *DhtPackage) DhtErrno

Setup package from message

func (*DhtMessage) GetPbPackage

func (dhtMsg *DhtMessage) GetPbPackage() *pb.DhtPackage

Setup protobuf package from message

func (*DhtMessage) GetPingMessage

func (dhtMsg *DhtMessage) GetPingMessage(pbMsg *pb.DhtMessage_Ping) DhtErrno

Setup dht ping message from protobuf message

func (*DhtMessage) GetPingPackage

func (dhtMsg *DhtMessage) GetPingPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht ping package from dht message

func (*DhtMessage) GetPongMessage

func (dhtMsg *DhtMessage) GetPongMessage(pbMsg *pb.DhtMessage_Pong) DhtErrno

Setup dht pong message from protobuf message

func (*DhtMessage) GetPongPackage

func (dhtMsg *DhtMessage) GetPongPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht pong package from dht message

func (*DhtMessage) GetPutProviderMessage

func (dhtMsg *DhtMessage) GetPutProviderMessage(pbMsg *pb.DhtMessage_PutProvider) DhtErrno

Setup dht put-provider message from protobuf message

func (*DhtMessage) GetPutProviderPackage

func (dhtMsg *DhtMessage) GetPutProviderPackage(dhtPkg *DhtPackage) DhtErrno

Setup dht put-provider package from dht message

func (*DhtMessage) GetPutValueMessage

func (dhtMsg *DhtMessage) GetPutValueMessage(pbMsg *pb.DhtMessage_PutValue) DhtErrno

Setup dht put-value message from protobuf message

func (*DhtMessage) GetPutValuePackage

func (dhtMsg *DhtMessage) GetPutValuePackage(dhtPkg *DhtPackage) DhtErrno

Setup dht put-value package from dht message

type DhtMgr

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

Dht manager control block

func NewDhtMgr

func NewDhtMgr() *DhtMgr

Create DHT manager

func (*DhtMgr) DhtCommand

func (dhtMgr *DhtMgr) DhtCommand(cmd int, msg interface{}) sch.SchErrno

dht command

func (*DhtMgr) GetScheduler

func (dhtMgr *DhtMgr) GetScheduler() *sch.Scheduler

get scheduler of manager

func (*DhtMgr) InstallEventCallback

func (dhtMgr *DhtMgr) InstallEventCallback(cbf DhtCallback) DhtErrno

install callback

func (*DhtMgr) TaskProc4Scheduler

func (dhtMgr *DhtMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to scheduler

type DhtPackage

type DhtPackage struct {
	Pid           uint32 // protocol identity
	PayloadLength uint32 // payload length
	Payload       []byte // payload
}

Package for DHT protocol

func (*DhtPackage) FromPbPackage

func (dhtPkg *DhtPackage) FromPbPackage(pbPkg *pb.DhtPackage) DhtErrno

Setup dht package from protobuf package

func (*DhtPackage) GetMessage

func (dhtPkg *DhtPackage) GetMessage(dhtMsg *DhtMessage) DhtErrno

Extract message from package

func (*DhtPackage) ToPbPackage

func (dhtPkg *DhtPackage) ToPbPackage(pbPkg *pb.DhtPackage) DhtErrno

Setup protobuf package from dht package

type DhtProtocol

type DhtProtocol struct {
	Pid uint32              // protocol identity
	Ver [DhtProtoBytes]byte // protocol version: M.m0.m1.m2
}

type DhtProvider

type DhtProvider struct {
	Key   DhtKey         // key of provider
	Nodes []*config.Node // node of provider
	Extra interface{}    // extra inforamtion
}

Provider

type DhtProviderStoreRecord

type DhtProviderStoreRecord struct {
	Key       []byte         // key
	Providers []*config.Node // providers
	Extra     []byte         // extra info
}

Provider store (key, provider) record

func (*DhtProviderStoreRecord) DecPsRecord

func (dhtPsRec *DhtProviderStoreRecord) DecPsRecord(psr *PsRecord) DhtErrno

Decode provider store (key, provider) record

func (*DhtProviderStoreRecord) EncPsRecord

func (dhtPsRec *DhtProviderStoreRecord) EncPsRecord(psr *PsRecord) DhtErrno

Encode provider store (key, provider) record

type DhtVal

type DhtVal = []byte

type DhtValue

type DhtValue struct {
	Key   DhtKey      // key of value
	Val   DhtVal      // value
	Extra interface{} // extra inforamtion
}

type DiffTimer

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

type DiffTimerCallback

type DiffTimerCallback func(interface{}) error

DTM(Difference Timer Manager)

type DiffTimerManager

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

func NewDiffTimerManager

func NewDiffTimerManager(tick time.Duration, cbf DiffTimerCallback) *DiffTimerManager

type DsKey

type DsKey = config.DsKey

type DsMgr

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

Data store manager

func NewDsMgr

func NewDsMgr() *DsMgr

Create data store manager

func (*DsMgr) Delete

func (dsMgr *DsMgr) Delete(k []byte) DhtErrno

delete

func (*DsMgr) Get

func (dsMgr *DsMgr) Get(k []byte) (eno DhtErrno, value DsValue)

get

func (*DsMgr) IsBusy

func (dsMgr *DsMgr) IsBusy() bool

func (*DsMgr) Put

func (dsMgr *DsMgr) Put(k []byte, v DsValue, kt time.Duration) DhtErrno

put

func (*DsMgr) TaskProc4Scheduler

func (dsMgr *DsMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to scheduler

type DsQuery

type DsQuery = interface{}

Datastore query

type DsQueryResult

type DsQueryResult = interface{}

Datastore query result

type DsRecord

type DsRecord struct {
	Key   DsKey   // record key
	Value DsValue // record value
}

Data store record

type DsValue

type DsValue = interface{}

Datastore value

type FileDatastore

type FileDatastore struct{}

func NewFileDatastore

func NewFileDatastore(cfg *FileDatastoreConfig) *FileDatastore

func (*FileDatastore) Close

func (fds *FileDatastore) Close() DhtErrno

func (*FileDatastore) Delete

func (fds *FileDatastore) Delete(k []byte) DhtErrno

func (*FileDatastore) Get

func (fds *FileDatastore) Get(k []byte) (eno DhtErrno, value DsValue)

func (*FileDatastore) Put

func (fds *FileDatastore) Put(k []byte, v DsValue, kt time.Duration) DhtErrno

type FileDatastoreConfig

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

type FindNode

type FindNode struct {
	From   config.Node  // source node
	To     config.Node  // destination node
	Target config.DsKey // target node identity
	Id     int64        // message identity
	Extra  []byte       // extra info
}

type GetProviderReq

type GetProviderReq struct {
	From  config.Node // source node
	To    config.Node // destination node
	Key   DhtKey      // key wanted
	Id    int64       // message identity
	Extra []byte      // extra info
}

type GetProviderRsp

type GetProviderRsp struct {
	From     config.Node    // source node
	To       config.Node    // destination node
	Provider *DhtProvider   // provider
	Key      DhtKey         // key
	Nodes    []*config.Node // neighbor nodes
	Pcs      []int          // peer connection status
	Id       int64          // message identity
	Extra    []byte         // extra info
}

type GetValueReq

type GetValueReq struct {
	From  config.Node // source node
	To    config.Node // destination node
	Key   DhtKey      // keys requested
	Id    int64       // message identity
	Extra []byte      // extra info
}

type GetValueRsp

type GetValueRsp struct {
	From  config.Node    // source node
	To    config.Node    // destination node
	Value *DhtValue      // values
	Key   DhtKey         // keys requested
	Nodes []*config.Node // neighbor nodes
	Pcs   []int          // peer connection status
	Id    int64          // message identity
	Extra []byte         // extra info
}

type Handshake

type Handshake struct {
	ChainId   uint32        // chain identity
	Dir       int           // direct
	NodeId    config.NodeID // node identity
	IP        net.IP        // ip address
	UDP       uint32        // udp port number
	TCP       uint32        // tcp port number
	ProtoNum  uint32        // number of protocols supported
	Protocols []DhtProtocol // version of protocol
	Extra     []byte        // extra info
}

type Hash

type Hash [HashByteLength]byte

Hash type

func RutMgrNodeId2Hash

func RutMgrNodeId2Hash(id config.NodeID) *Hash

Node identity to hash(sha) exported

type LeveldbDatastore

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

func NewLeveldbDatastore

func NewLeveldbDatastore(cfg *LeveldbDatastoreConfig) *LeveldbDatastore

func (*LeveldbDatastore) Close

func (lds *LeveldbDatastore) Close() DhtErrno

func (*LeveldbDatastore) Delete

func (lds *LeveldbDatastore) Delete(k []byte) DhtErrno

func (*LeveldbDatastore) Get

func (lds *LeveldbDatastore) Get(k []byte) (eno DhtErrno, value DsValue)

func (*LeveldbDatastore) Put

func (lds *LeveldbDatastore) Put(k []byte, v DsValue, kt time.Duration) DhtErrno

type LeveldbDatastoreConfig

type LeveldbDatastoreConfig struct {
	Path                   string
	OpenFilesCacheCapacity int
	BlockCacheCapacity     int
	BlockSize              int
	FilterBits             int
}

type LsnMgr

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

Listener manager

func NewLsnMgr

func NewLsnMgr() *LsnMgr

Create listener manager

func (*LsnMgr) ForceAcceptOut

func (lsnMgr *LsnMgr) ForceAcceptOut() DhtErrno

Froce to get out from accept call

func (*LsnMgr) TaskProc4Scheduler

func (lsnMgr *LsnMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type MapDatastore

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

Data store based on "map" in memory, for test only

func NewMapDatastore

func NewMapDatastore() *MapDatastore

New map datastore

func (*MapDatastore) Close

func (mds *MapDatastore) Close() DhtErrno

Clsoe

func (*MapDatastore) Delete

func (mds *MapDatastore) Delete(k []byte) DhtErrno

Delete

func (*MapDatastore) Get

func (mds *MapDatastore) Get(k []byte) (eno DhtErrno, value DsValue)

Get

func (*MapDatastore) Put

func (mds *MapDatastore) Put(k []byte, v DsValue, kt time.Duration) DhtErrno

Put

type Neighbors

type Neighbors struct {
	From  config.Node    // source node
	To    config.Node    // destination node
	Nodes []*config.Node // neighbor nodes
	Pcs   []int          // peer connection status
	Id    int64          // message identity
	Extra []byte         // extra info
}

type Ping

type Ping struct {
	From  config.Node // from whom
	To    config.Node // to whom
	Seq   int64       // sequence
	Extra []byte      // extra info
}

type Pong

type Pong struct {
	From  config.Node // from whom
	To    config.Node // to whom
	Seq   int64       // sequence
	Extra []byte      // extra info
}

type PrdMgr

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

Provider manager

func NewPrdMgr

func NewPrdMgr() *PrdMgr

Create provider manager

func (*PrdMgr) TaskProc4Scheduler

func (prdMgr *PrdMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type PrdSet

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

Provider set

type PsRecord

type PsRecord struct {
	Key   DsKey         // provider record key
	Value DsValue       // provider record value
	KT    time.Duration // duratio to keep this [key, val] pair
}

Provider data store record

type PutProvider

type PutProvider struct {
	From     config.Node  // source node
	To       config.Node  // destination node
	Provider *DhtProvider // providers
	Pcs      []int        // prividers connection status
	Id       int64        // message identity
	Extra    []byte       // extra info
}

type PutValue

type PutValue struct {
	From   config.Node   // source node
	To     config.Node   // destination node
	Values []DhtValue    // values
	Id     int64         // message identity
	KT     time.Duration // duration to keep this [key, val] pair
	Extra  []byte        // extra info
}

type QryInst

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

Query instance

func NewQryInst

func NewQryInst() *QryInst

Create query instance

func (*QryInst) TaskProc4Scheduler

func (qryInst *QryInst) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type QryMgr

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

Query manager

func NewQryMgr

func NewQryMgr() *QryMgr

Create query manager

func (*QryMgr) TaskProc4Scheduler

func (qryMgr *QryMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type QryStatus

type QryStatus = int

Query control block status

type RutMgr

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

Route manager

func NewRutMgr

func NewRutMgr() *RutMgr

Create route manager

func (*RutMgr) TaskProc4Scheduler

func (rutMgr *RutMgr) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to shceduler

type TimerCallback

type TimerCallback = func(el *list.Element, data interface{}) interface{}

type TimerManager

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

func NewTimerManager

func NewTimerManager(sdl string, tag string) *TimerManager

func (*TimerManager) GetTimer

func (mgr *TimerManager) GetTimer(dur time.Duration, dat interface{}, tcb TimerCallback) (interface{}, error)

func (*TimerManager) KillTimer

func (mgr *TimerManager) KillTimer(ptm interface{}) error

func (*TimerManager) SetTimerData

func (mgr *TimerManager) SetTimerData(ptm interface{}, data interface{}) error

func (*TimerManager) SetTimerHandler

func (mgr *TimerManager) SetTimerHandler(ptm interface{}, tcb TimerCallback) error

func (*TimerManager) SetTimerKey

func (mgr *TimerManager) SetTimerKey(ptm interface{}, key []byte) error

func (*TimerManager) StartTimer

func (mgr *TimerManager) StartTimer(ptm interface{}) error

func (*TimerManager) TickProc

func (mgr *TimerManager) TickProc() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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