protocol

package
v0.5.2-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: Apache-2.0 Imports: 9 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
	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
	GetAddr() string
	GetPort() uint16
	GetAddrStr() string
	GetAddr16() ([16]byte, error)
	GetHttpJsonPort() uint16
	//TODO SetHttpJsonPort(uint16)
	GetWsPort() uint16
	//TODO SetWsPort(uint16)
	GetSyncState() SyncState
	SetSyncState(s SyncState)
	SetSyncStopHash(hash Uint256, height uint32)
	SyncBlock(bool)
	SyncBlockMonitor(bool)
	StopSyncBlock(bool)
	GetPubKey() *crypto.PubKey
	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()
	Tx(buf []byte)
	GetTime() int64
	GetEvent(eventName string) *events.Event
	GetNeighborAddrs() ([]NodeAddr, uint)
	GetTransaction(hash Uint256) *transaction.Transaction
	IncRxTxnCnt()
	GetTxnCnt() uint64
	GetRxTxnCnt() uint64

	Xmit(interface{}) error
	Broadcast([]byte) error
	GetNeighborHeights() ([]uint32, uint)
	CleanSubmittedTransactions(txns []*transaction.Transaction) error

	GetNeighborNoder() []Noder
	GetSyncFinishedNeighbors() []Noder
	StoreFlightHeight(height uint32)
	GetFlightHeightCnt() int
	RemoveFlightHeightLessThan(height uint32)
	RemoveFlightHeight(height uint32)
	SetHeight(height uint32)
	WaitForSyncBlkFinish()
	GetFlightHeights() []uint32

	GetChordAddr() []byte
	StartRelayer(wallet vault.Wallet)
	SendRelayPacket(srcAddr, destAddr string, payload, signature []byte, maxHoldingSeconds uint32) error
	SendRelayPacketsInBuffer(clientId []byte) error
	GetWsAddr() string
	FindWsAddr([]byte) (string, error)
	FindSuccessorAddrs([]byte, int) ([]string, 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