Documentation
¶
Index ¶
- Constants
- Variables
- func MemberRaftID(memberID string, clusterConfig *types.ClusterConfig) (uint64, error)
- func NewCatchUpClient(lg *logger.SugarLogger, tlsConfig *tls.Config) *catchUpClient
- func NewCatchupHandler(lg *logger.SugarLogger, ledgerReader LedgerReader, maxResponseBytes int) *catchupHandler
- type Config
- type ConsensusListener
- type HTTPTransport
- func (p *HTTPTransport) ClientTLSConfig() *tls.Config
- func (p *HTTPTransport) Close()
- func (p *HTTPTransport) PullBlocks(ctx context.Context, startBlock, endBlock, leaderID uint64) ([]*types.Block, error)
- func (p *HTTPTransport) SendConsensus(msgs []raftpb.Message) error
- func (p *HTTPTransport) SetConsensusListener(l ConsensusListener) error
- func (p *HTTPTransport) Start() error
- func (p *HTTPTransport) UpdateClusterConfig(clusterConfig *types.ClusterConfig) error
- type HeightResponse
- type LedgerReader
- type LogAdapter
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 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 LogAdapter ¶
type LogAdapter struct { SugarLogger *logger.SugarLogger Debug bool }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.