topics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Topics = [...]topicBuf{
	topicBuf{Version, *(bytes.NewBuffer([]byte{byte(Version)})), "version"},
	topicBuf{VerAck, *(bytes.NewBuffer([]byte{byte(VerAck)})), "verack"},
	topicBuf{Ping, *(bytes.NewBuffer([]byte{byte(Ping)})), "ping"},
	topicBuf{Pong, *(bytes.NewBuffer([]byte{byte(Pong)})), "pong"},
	topicBuf{Addr, *(bytes.NewBuffer([]byte{byte(Addr)})), "addr"},
	topicBuf{GetAddr, *(bytes.NewBuffer([]byte{byte(GetAddr)})), "getaddr"},
	topicBuf{GetData, *(bytes.NewBuffer([]byte{byte(GetData)})), "getdata"},
	topicBuf{GetBlocks, *(bytes.NewBuffer([]byte{byte(GetBlocks)})), "getblocks"},
	topicBuf{GetHeaders, *(bytes.NewBuffer([]byte{byte(GetHeaders)})), "getheaders"},
	topicBuf{Tx, *(bytes.NewBuffer([]byte{byte(Tx)})), "tx"},
	topicBuf{Block, *(bytes.NewBuffer([]byte{byte(Block)})), "block"},
	topicBuf{AcceptedBlock, *(bytes.NewBuffer([]byte{byte(AcceptedBlock)})), "acceptedblock"},
	topicBuf{Headers, *(bytes.NewBuffer([]byte{byte(Headers)})), "headers"},
	topicBuf{MemPool, *(bytes.NewBuffer([]byte{byte(MemPool)})), "mempool"},
	topicBuf{Inv, *(bytes.NewBuffer([]byte{byte(Inv)})), "inv"},
	topicBuf{Certificate, *(bytes.NewBuffer([]byte{byte(Certificate)})), "certificate"},
	topicBuf{GetRoundResults, *(bytes.NewBuffer([]byte{byte(GetRoundResults)})), "getroundresults"},
	topicBuf{RoundResults, *(bytes.NewBuffer([]byte{byte(RoundResults)})), "roundresults"},
	topicBuf{GetCandidate, *(bytes.NewBuffer([]byte{byte(GetCandidate)})), "getcandidate"},
	topicBuf{Candidate, *(bytes.NewBuffer([]byte{byte(Candidate)})), "candidate"},
	topicBuf{Score, *(bytes.NewBuffer([]byte{byte(Score)})), "score"},
	topicBuf{Reduction, *(bytes.NewBuffer([]byte{byte(Reduction)})), "reduction"},
	topicBuf{Agreement, *(bytes.NewBuffer([]byte{byte(Agreement)})), "agreement"},
	topicBuf{StartConsensus, *(bytes.NewBuffer([]byte{byte(StartConsensus)})), "startconsensus"},
	topicBuf{Gossip, *(bytes.NewBuffer([]byte{byte(Gossip)})), "gossip"},
	topicBuf{NotFound, *(bytes.NewBuffer([]byte{byte(NotFound)})), "notfound"},
	topicBuf{Unknown, *(bytes.NewBuffer([]byte{byte(Unknown)})), "unknown"},
	topicBuf{Reject, *(bytes.NewBuffer([]byte{byte(Reject)})), "reject"},
	topicBuf{Initialization, *(bytes.NewBuffer([]byte{byte(Initialization)})), "initialization"},
	topicBuf{RoundUpdate, *(bytes.NewBuffer([]byte{byte(RoundUpdate)})), "roundupdate"},
	topicBuf{BestScore, *(bytes.NewBuffer([]byte{byte(BestScore)})), "bestscore"},
	topicBuf{Quit, *(bytes.NewBuffer([]byte{byte(Quit)})), "quit"},
	topicBuf{Log, *(bytes.NewBuffer([]byte{byte(Log)})), "log"},
	topicBuf{Monitor, *(bytes.NewBuffer([]byte{byte(Log)})), "monitor_topic"},
	topicBuf{Test, *(bytes.NewBuffer([]byte{byte(Test)})), "__test"},
	topicBuf{StepVotes, *(bytes.NewBuffer([]byte{byte(StepVotes)})), "stepvotes"},
	topicBuf{ScoreEvent, *(bytes.NewBuffer([]byte{byte(ScoreEvent)})), "scoreevent"},
	topicBuf{Generation, *(bytes.NewBuffer([]byte{byte(Generation)})), "generation"},
	topicBuf{Restart, *(bytes.NewBuffer([]byte{byte(Restart)})), "restart"},
	topicBuf{StopConsensus, *(bytes.NewBuffer([]byte{byte(StopConsensus)})), "stopconsensus"},
	topicBuf{IntermediateBlock, *(bytes.NewBuffer([]byte{byte(IntermediateBlock)})), "intermediateblock"},
	topicBuf{HighestSeen, *(bytes.NewBuffer([]byte{byte(HighestSeen)})), "highestseen"},
}

Functions

func Prepend added in v0.2.0

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

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
	Addr
	GetAddr
	GetData
	GetBlocks
	GetHeaders
	Tx
	Block
	AcceptedBlock
	Headers
	MemPool
	Inv
	Certificate
	GetRoundResults
	RoundResults
	GetCandidate

	// Consensus topics
	Candidate
	Score
	Reduction
	Agreement
	StartConsensus

	// Peer topics
	Gossip

	// Error topics
	NotFound
	Unknown
	Reject

	//Internal
	Initialization
	RoundUpdate
	BestScore
	Quit
	Log
	Monitor
	Test
	StepVotes
	ScoreEvent
	Generation
	Restart
	StopConsensus
	IntermediateBlock
	HighestSeen
)

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

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

Jump to

Keyboard shortcuts

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