topics

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Topics = [...]topicBuf{
	{Version, *(bytes.NewBuffer([]byte{byte(Version)})), "version"},
	{VerAck, *(bytes.NewBuffer([]byte{byte(VerAck)})), "verack"},
	{Ping, *(bytes.NewBuffer([]byte{byte(Ping)})), "ping"},
	{Pong, *(bytes.NewBuffer([]byte{byte(Pong)})), "pong"},
	{GetData, *(bytes.NewBuffer([]byte{byte(GetData)})), "getdata"},
	{GetBlocks, *(bytes.NewBuffer([]byte{byte(GetBlocks)})), "getblocks"},
	{Tx, *(bytes.NewBuffer([]byte{byte(Tx)})), "tx"},
	{Block, *(bytes.NewBuffer([]byte{byte(Block)})), "block"},
	{AcceptedBlock, *(bytes.NewBuffer([]byte{byte(AcceptedBlock)})), "acceptedblock"},
	{MemPool, *(bytes.NewBuffer([]byte{byte(MemPool)})), "mempool"},
	{Inv, *(bytes.NewBuffer([]byte{byte(Inv)})), "inv"},
	{Candidate, *(bytes.NewBuffer([]byte{byte(Candidate)})), "candidate"},
	{Score, *(bytes.NewBuffer([]byte{byte(Score)})), "score"},
	{Reduction, *(bytes.NewBuffer([]byte{byte(Reduction)})), "reduction"},
	{Agreement, *(bytes.NewBuffer([]byte{byte(Agreement)})), "agreement"},
	{Gossip, *(bytes.NewBuffer([]byte{byte(Gossip)})), "gossip"},
	{Unknown, *(bytes.NewBuffer([]byte{byte(Unknown)})), "unknown"},
	{Reject, *(bytes.NewBuffer([]byte{byte(Reject)})), "reject"},
	{Quit, *(bytes.NewBuffer([]byte{byte(Quit)})), "quit"},
	{Log, *(bytes.NewBuffer([]byte{byte(Log)})), "log"},
	{Monitor, *(bytes.NewBuffer([]byte{byte(Log)})), "monitor_topic"},
	{Test, *(bytes.NewBuffer([]byte{byte(Test)})), "__test"},
	{GetMempoolTxs, *(bytes.NewBuffer([]byte{byte(GetMempoolTxs)})), "getmempooltxs"},
	{GetMempoolTxsBySize, *(bytes.NewBuffer([]byte{byte(GetMempoolTxsBySize)})), "getmempooltxsbysize"},
	{SendMempoolTx, *(bytes.NewBuffer([]byte{byte(SendMempoolTx)})), "sendmempooltx"},
	{VerifyStateTransition, *(bytes.NewBuffer([]byte{byte(VerifyStateTransition)})), "validatestatetransition"},
	{ExecuteStateTransition, *(bytes.NewBuffer([]byte{byte(ExecuteStateTransition)})), "executestatetransition"},
	{GetMempoolView, *(bytes.NewBuffer([]byte{byte(GetMempoolView)})), "getmempoolview"},
	{SendBidTx, *(bytes.NewBuffer([]byte{byte(SendBidTx)})), "sendbidtx"},
	{SendStakeTx, *(bytes.NewBuffer([]byte{byte(SendStakeTx)})), "sendstaketx"},
	{SendStandardTx, *(bytes.NewBuffer([]byte{byte(SendStandardTx)})), "sendstandardtx"},
	{GetBalance, *(bytes.NewBuffer([]byte{byte(GetBalance)})), "getbalance"},
	{GetUnconfirmedBalance, *(bytes.NewBuffer([]byte{byte(GetUnconfirmedBalance)})), "getunconfirmedbalance"},
	{GetAddress, *(bytes.NewBuffer([]byte{byte(GetAddress)})), "getaddress"},
	{GetTxHistory, *(bytes.NewBuffer([]byte{byte(GetTxHistory)})), "gettxhistory"},
	{AutomateConsensusTxs, *(bytes.NewBuffer([]byte{byte(AutomateConsensusTxs)})), "automateconsensustxs"},
	{GetSyncProgress, *(bytes.NewBuffer([]byte{byte(GetSyncProgress)})), "getsyncprogress"},
	{RebuildChain, *(bytes.NewBuffer([]byte{byte(RebuildChain)})), "rebuildchain"},
	{ClearWalletDatabase, *(bytes.NewBuffer([]byte{byte(ClearWalletDatabase)})), "clearwalletdatabase"},
	{StartProfile, *(bytes.NewBuffer([]byte{byte(StartProfile)})), "startprofile"},
	{StopProfile, *(bytes.NewBuffer([]byte{byte(StopProfile)})), "stopprofile"},
	{GetCandidate, *(bytes.NewBuffer([]byte{byte(GetCandidate)})), "getcandidate"},
	{SyncProgress, *(bytes.NewBuffer([]byte{byte(SyncProgress)})), "syncprogress"},
	{Kadcast, *(bytes.NewBuffer([]byte{byte(Kadcast)})), "kadcast"},
}

Topics represents the associated string and byte representation respectively of the Topic objects. NOTE: this needs to be in the same order in which the topics are declared.

Functions

func Prepend added in v0.2.0

func Prepend(b *bytes.Buffer, t Topic) error

Prepend a topic to a binary-serialized form of a message.

func Write

func Write(r io.Writer, topic Topic) error

Write a topic to a Writer.

Types

type Topic

type Topic uint8

Topic defines a topic.

const (
	// Standard topics.
	Version Topic = iota
	VerAck
	Ping
	Pong

	// Data exchange topics.
	GetData
	GetBlocks
	Tx
	Block
	AcceptedBlock
	MemPool
	Inv

	// Gossiped topics.
	Candidate
	Score
	Reduction
	Agreement

	// Peer topics.
	Gossip

	// Error topics.
	Unknown
	Reject

	// Internal.
	Quit
	Log
	Monitor
	Test

	// RPCBus topics.
	GetMempoolTxs
	GetMempoolTxsBySize
	SendMempoolTx
	VerifyStateTransition
	ExecuteStateTransition

	// Cross-process RPCBus topics.
	GetMempoolView
	SendBidTx
	SendStakeTx
	SendStandardTx
	GetBalance
	GetUnconfirmedBalance
	GetAddress
	GetTxHistory
	AutomateConsensusTxs
	GetSyncProgress
	RebuildChain
	ClearWalletDatabase
	StartProfile
	StopProfile

	// Cross-network RPCBus topics.
	GetCandidate

	// Monitoring topics.
	SyncProgress

	// Kadcast wire messaging.
	Kadcast
)

A list of all valid topics.

func Extract

func Extract(p io.Reader) (Topic, error)

Extract the topic from an io.Reader.

func StringToTopic added in v0.2.0

func StringToTopic(topic string) Topic

StringToTopic turns a string into a Topic if the Topic is in the enum of known topics. Return Unknown topic if the string is not coupled with any of them.

func (Topic) String added in v0.2.0

func (t Topic) String() string

String representation of a known topic.

func (Topic) ToBuffer added in v0.2.0

func (t Topic) ToBuffer() bytes.Buffer

ToBuffer returns Topic as a Buffer.

Jump to

Keyboard shortcuts

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