comm

package
v0.2.0-fix-docker Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BCDBPeerEndpoint = "/bcdb-peer/"
	GetBlocksPath    = BCDBPeerEndpoint + "blocks"
	GetHeightPath    = BCDBPeerEndpoint + "height"
)

Variables

View Source
var RetryIntervalMax = 10 * time.Second
View Source
var RetryIntervalMin = 10 * time.Millisecond

Functions

func MemberRaftID

func MemberRaftID(memberID string, clusterConfig *types.ClusterConfig) (uint64, error)

func NewCatchUpClient

func NewCatchUpClient(lg *logger.SugarLogger, tlsConfig *tls.Config) *catchUpClient

func NewCatchupHandler

func NewCatchupHandler(lg *logger.SugarLogger, ledgerReader LedgerReader, maxResponseBytes int) *catchupHandler

Types

type Config

type Config struct {
	LocalConf    *config.LocalConfiguration
	Logger       *logger.SugarLogger
	LedgerReader LedgerReader
}

type ConsensusListener

type ConsensusListener interface {
	rafthttp.Raft
}

type HTTPTransport

type HTTPTransport struct {
	// contains filtered or unexported fields
}

func NewHTTPTransport

func NewHTTPTransport(config *Config) (*HTTPTransport, error)

func (*HTTPTransport) ClientTLSConfig

func (p *HTTPTransport) ClientTLSConfig() *tls.Config

func (*HTTPTransport) Close

func (p *HTTPTransport) Close()

func (*HTTPTransport) PullBlocks

func (p *HTTPTransport) PullBlocks(ctx context.Context, startBlock, endBlock, leaderID uint64) ([]*types.Block, error)

PullBlocks tries to pull as many blocks as possible from startBlock to endBlock (inclusive).

The calling go-routine will block until some blocks are retrieved, depending on the availability of remote peers. The underlying implementation will poll the cluster members, starting from the leader hint (if exists), until it can retrieve some blocks. The call may return fewer blocks than requested. The `leaderID` is a hint to the leader's Raft ID, and can be 0. The call maybe canceled using the context `ctx`.

func (*HTTPTransport) SendConsensus

func (p *HTTPTransport) SendConsensus(msgs []raftpb.Message) error

func (*HTTPTransport) SetConsensusListener

func (p *HTTPTransport) SetConsensusListener(l ConsensusListener) error

func (*HTTPTransport) Start

func (p *HTTPTransport) Start() error

func (*HTTPTransport) UpdateClusterConfig

func (p *HTTPTransport) UpdateClusterConfig(clusterConfig *types.ClusterConfig) error

TODO implement dynamic re-config, currently it can only be updated once.

type HeightResponse

type HeightResponse struct {
	Height uint64
}

type LedgerReader

type LedgerReader interface {
	Height() (uint64, error)
	Get(blockNumber uint64) (*types.Block, error)
}

type LogAdapter

type LogAdapter struct {
	SugarLogger *logger.SugarLogger
	Debug       bool
}

func (*LogAdapter) Write

func (l *LogAdapter) Write(p []byte) (n int, err error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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