table

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: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TabMgrEnoNone = iota
	TabMgrEnoConfig
	TabMgrEnoParameter
	TabMgrEnoScheduler
	TabMgrEnoDatabase
	TabMgrEnoNotFound
	TabMgrEnoDuplicated
	TabMgrEnoMismatched
	TabMgrEnoInternal
	TabMgrEnoFindNodeFailed
	TabMgrEnoPingpongFailed
	TabMgrEnoTimeout
	TabMgrEnoUdp
	TabMgrEnoResource
	TabMgrEnoRemove
	TabMgrEnoBootstrap
)

errno

View Source
const (
	TabInstStateNull     = iota // null instance state
	TabInstStateQuering         // FindNode sent but had not been responsed yet
	TabInstStateBonding         // Ping sent but hand not been responsed yet
	TabInstStateQTimeout        // query timeout
	TabInstStateBTimeout        // bound timeout
)

Instance control block

View Source
const (
	TabInstQPendingMax = 16  // max nodes in pending for quering
	TabInstBPendingMax = 128 // max nodes in pending for bounding
	TabInstQueringMax  = 8   // max concurrency quering instances
	TabInstBondingMax  = 64  // max concurrency bonding instances
)
View Source
const Closest4Queried = 0
View Source
const Closest4Querying = 1
View Source
const HashBits = HashLength * 8 // bits number of hash
View Source
const HashLength = 32 // 32 bytes(256 bits) hash applied

Hash type

View Source
const NdbcName = "ndbCleaner"

Static task to keep the node database clean

View Source
const TabMgrName = sch.TabMgrName

Table manager

Variables

View Source
var AnySubNet = config.AnySubNet
View Source
var ZeroSubNet = config.ZeroSubNet

Functions

func DecodeBytes

func DecodeBytes(blob []byte, node *Node, snid *SubNetworkID) error

func EncodeToBytes

func EncodeToBytes(snid SubNetworkID, node *Node) ([]byte, error)

func GetSubnetIdentity

func GetSubnetIdentity(id config.NodeID, maskBits int) (config.SubNetworkID, error)

func TabCheckPrivateIp

func TabCheckPrivateIp(ip net.IP) bool

Types

type Hash

type Hash [HashLength]byte

func TabNodeId2Hash

func TabNodeId2Hash(id NodeID) *Hash

type Node

type Node struct {
	config.Node // our Node type
	// contains filtered or unexported fields
}

func TabBuildNode

func TabBuildNode(pn *config.Node) *Node

type NodeDbCleaner

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

func NewNdbCleaner

func NewNdbCleaner() *NodeDbCleaner

func (*NodeDbCleaner) TaskProc4Scheduler

func (ndbc *NodeDbCleaner) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

type NodeID

type NodeID = config.NodeID

Bucket entry

type SubNetworkID

type SubNetworkID = config.SubNetworkID

type TabMgrErrno

type TabMgrErrno int

type TableManager

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

func NewTabMgr

func NewTabMgr() *TableManager

func (*TableManager) TabBucketAddNode

func (tabMgr *TableManager) TabBucketAddNode(snid SubNetworkID, n *um.Node, lastQuery *time.Time, lastPing *time.Time, lastPong *time.Time) TabMgrErrno

func (*TableManager) TabClosest

func (tabMgr *TableManager) TabClosest(forWhat int, target NodeID, mbs int, size int) []*Node

func (*TableManager) TabGetInstAll

func (tabMgr *TableManager) TabGetInstAll() *map[SubNetworkID]*TableManager

func (*TableManager) TabGetInstBySubNetId

func (tabMgr *TableManager) TabGetInstBySubNetId(snid *SubNetworkID) *TableManager

func (*TableManager) TabGetSubNetId

func (tabMgr *TableManager) TabGetSubNetId() *SubNetworkID

func (*TableManager) TabUpdateNode

func (tabMgr *TableManager) TabUpdateNode(snid SubNetworkID, umn *um.Node) TabMgrErrno

func (*TableManager) TaskProc4Scheduler

func (tabMgr *TableManager) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Jump to

Keyboard shortcuts

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