tmp2p

package
v0.0.0-...-63a5211 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package tmp2p contains high-level interfaces for the peer-to-peer layer for [tmengine].

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	// ConsensusBroadcaster returns a ConsensusBroadcaster derived from this connection,
	// or nil if the connection does not support consensus broadcasting.
	ConsensusBroadcaster() ConsensusBroadcaster

	// Set the underlying consensus handler,
	// controlling how to respond to incoming consensus messages from the network.
	// The Connection implementation may have special handling for nil values.
	//
	// This is a method at runtime rather than a parameter to the constructor,
	// because you typically already need a connection before you can create the engine;
	// then once you have a running engine you call conn.SetConsensusHandler(e)
	// so that new messages are validated based on the engine's state.
	SetConsensusHandler(context.Context, tmconsensus.ConsensusHandler)

	// Disconnect the connection, rendering it unusable.
	Disconnect()

	// Disconnected returns a channel that is closed after Disconnect() completes.
	Disconnected() <-chan struct{}
}

Connection is the generalized connection to the p2p network.

It contains different methods to work with specific layers of the p2p network, such as ConsensusBroadcaster to work with only broadcasting consensus messages.

It also enables disconnecting from the p2p network altogether (which must invalidate further use of the connection). and dynamically changing the underlying tmconsensus.ConsensusHandler.

type ConsensusBroadcaster

type ConsensusBroadcaster interface {
	OutgoingProposedHeaders() chan<- tmconsensus.ProposedHeader

	OutgoingPrevoteProofs() chan<- tmconsensus.PrevoteSparseProof
	OutgoingPrecommitProofs() chan<- tmconsensus.PrecommitSparseProof
}

ConsensusBroadcaster is the set of methods to publish consensus messages to the network.

Directories

Path Synopsis
Package tmlibp2p contains implementations of the tmp2p interfaces using github.com/libp2p/go-libp2p.
Package tmlibp2p contains implementations of the tmp2p interfaces using github.com/libp2p/go-libp2p.
tmlibp2ptest
Package tmlibp2ptest provides the Network type that is useful for tests that need to instantiate a Gordian peer-to-peer network backed by tmlibp2p.
Package tmlibp2ptest provides the Network type that is useful for tests that need to instantiate a Gordian peer-to-peer network backed by tmlibp2p.
Package tmp2ptest contains compliance tests for tmp2p implementations, and it also provides some other types that are useful in tests.
Package tmp2ptest contains compliance tests for tmp2p implementations, and it also provides some other types that are useful in tests.

Jump to

Keyboard shortcuts

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