protocol

package
v0.3.12-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INIT       = 0
	HAND       = 1
	HANDSHAKE  = 2
	HANDSHAKED = 3
	ESTABLISH  = 4
	INACTIVITY = 5
)

node connection state

Variables

View Source
var SyncStateString = []string{"SyncStarted", "SyncFinished", "PersistFinished"}

SyncStateString is the string of SyncState enum

Functions

This section is empty.

Types

type NodeAddr

type NodeAddr struct {
	Time     int64
	Services uint64
	IpAddr   [16]byte
	Port     uint16
	ID       uint64
}

func (*NodeAddr) Deserialization

func (msg *NodeAddr) Deserialization(p []byte) error

func (NodeAddr) Serialization

func (msg NodeAddr) Serialization() ([]byte, error)

type Noder

type Noder interface {
	Version() uint32
	GetID() uint64
	Services() uint64
	GetAddr() string
	GetPort() uint16
	GetAddrStr() string
	GetHttpInfoPort() uint16
	SetHttpInfoPort(uint16)
	GetHttpJsonPort() uint16
	//TODO SetHttpJsonPort(uint16)
	GetWebSockPort() uint16
	//TODO SetWebSockPort(uint16)
	GetChordPort() uint16
	//TODO SetChordPort(uint16)
	GetHttpInfoState() bool
	SetHttpInfoState(bool)
	GetState() uint32
	SetState(state uint32)
	GetSyncState() SyncState
	SetSyncState(s SyncState)
	SetSyncStopHash(hash Uint256, height uint32)
	SyncBlock(bool)
	SyncBlockMonitor(bool)
	StopSyncBlock(bool)
	GetRelay() bool
	GetPubKey() *crypto.PubKey
	CompareAndSetState(old, new uint32) bool
	UpdateRXTime(t time.Time)
	LocalNode() Noder
	DelNbrNode(id uint64) (Noder, bool)
	AddNbrNode(Noder)
	CloseConn()
	GetHeight() uint32
	GetConnectionCnt() uint
	GetTxnByCount(int, Uint256) (map[Uint256]*transaction.Transaction, error)
	GetTxnPool() *pool.TxnPool
	AppendTxnPool(*transaction.Transaction) ErrCode
	ExistHash(hash Uint256) bool
	DumpInfo()
	UpdateInfo(t time.Time, version uint32, services uint64, port uint16, nonce uint64, relay uint8, height uint32)
	ConnectNeighbors()
	Connect(nodeAddr string) error
	Tx(buf []byte)
	GetTime() int64
	NodeEstablished(uid uint64) bool
	GetEvent(eventName string) *events.Event
	GetNeighborAddrs() ([]NodeAddr, uint64)
	GetTransaction(hash Uint256) *transaction.Transaction
	IncRxTxnCnt()
	GetTxnCnt() uint64
	GetRxTxnCnt() uint64

	Xmit(interface{}) error
	BroadcastTransaction(from Noder, txn *transaction.Transaction) error
	GetBookKeeperAddr() *crypto.PubKey
	GetBookKeepersAddrs() ([]*crypto.PubKey, uint64)
	SetBookKeeperAddr(pk *crypto.PubKey)
	GetNeighborHeights() ([]uint32, uint64)
	CleanSubmittedTransactions(txns []*transaction.Transaction) error

	GetNeighborNoder() []Noder
	GetSyncFinishedNeighbors() []Noder
	GetNbrNodeCnt() uint32
	StoreFlightHeight(height uint32)
	GetFlightHeightCnt() int
	RemoveFlightHeightLessThan(height uint32)
	RemoveFlightHeight(height uint32)
	GetLastRXTime() time.Time
	SetHeight(height uint32)
	WaitForSyncBlkFinish()
	GetFlightHeights() []uint32
	IsAddrInNeighbors(addr string) bool
	IsChordAddrInNeighbors(chordAddr []byte) bool
	ShouldChordAddrInNeighbors(addr []byte) (bool, error)
	SetAddrInConnectingList(addr string) bool
	RemoveAddrInConnectingList(addr string)
	AddInRetryList(addr string)
	RemoveFromRetryList(addr string)
	AcquireMsgHandlerChan()
	ReleaseMsgHandlerChan()
	AcquireHeaderReqChan()
	ReleaseHeaderReqChan()

	GetChordAddr() []byte
	SetChordAddr([]byte)
	GetChordRing() *chord.Ring
	StartRelayer(wallet vault.Wallet)
	NextHop(key []byte) (Noder, error)
	SendRelayPacket(srcAddr, destAddr string, payload, signature []byte) error
	SendRelayPacketsInBuffer(clientId []byte) error
}

type SyncState

type SyncState byte
const (
	SyncStarted     SyncState = 0
	SyncFinished    SyncState = 1
	PersistFinished SyncState = 2
)

Jump to

Keyboard shortcuts

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