Documentation
¶
Index ¶
- Constants
- Variables
- func SetLogging(level logging.Lvl, handler logging.Handler)
- func Try(maxRetries int, fn TryFunc) error
- func TryForever(fn TryFunc) error
- type AfterFunc
- type BlockFetcher
- type BlockFetcherOption
- type BlockValidator
- type BlockValidatorOption
- type Config
- type Doer
- type Fetcher
- type NodeList
- type Pool
- type SyncController
- type SyncInfo
- type SyncProgress
- type Syncer
- type SyncerOption
- type TryFunc
- type Validator
- type Watcher
- type WatcherOption
Constants ¶
View Source
const ( SyncPoolSize uint64 = 300 FetchTimeout = 1 * time.Minute RetryInterval = 10 * time.Second CheckBlockHeightInterval = 30 * time.Second CheckPrevBlockInterval = 30 * time.Second WatchInterval = 5 * time.Second )
View Source
const MaxRetries = 10
Variables ¶
View Source
var ErrFinished = errors.New("Add: Pool is finished")
Functions ¶
func TryForever ¶
Types ¶
type BlockFetcher ¶
type BlockFetcher struct {
// contains filtered or unexported fields
}
func NewBlockFetcher ¶
func NewBlockFetcher( cm network.ConnectionManager, client Doer, st *storage.LevelDBBackend, localNode *node.LocalNode, opts ...BlockFetcherOption) *BlockFetcher
type BlockFetcherOption ¶
type BlockFetcherOption = func(f *BlockFetcher)
type BlockValidator ¶
type BlockValidator struct {
// contains filtered or unexported fields
}
func NewBlockValidator ¶
func NewBlockValidator(ldb *storage.LevelDBBackend, tp *transaction.Pool, cfg common.Config, opts ...BlockValidatorOption) *BlockValidator
type BlockValidatorOption ¶
type BlockValidatorOption func(*BlockValidator)
type Config ¶
type Config struct {
SyncPoolSize uint64
FetchTimeout time.Duration
RetryInterval time.Duration
CheckBlockHeightInterval time.Duration
CheckPrevBlockInterval time.Duration
WatchInterval time.Duration
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(localNode *node.LocalNode, st *storage.LevelDBBackend, cm network.ConnectionManager, tp *transaction.Pool, cfg common.Config) (*Config, error)
func (*Config) LoggingConfig ¶
func (c *Config) LoggingConfig()
func (*Config) NewFetcher ¶
func (*Config) NewHTTP2Client ¶
func (c *Config) NewHTTP2Client() *common.HTTP2Client
func (*Config) NewValidator ¶
func (*Config) NewWatcher ¶
func (c *Config) NewWatcher(s SyncController) *Watcher
type NodeList ¶
type NodeList struct {
// contains filtered or unexported fields
}
func (*NodeList) SetLatestNodeAddrs ¶
type SyncController ¶
type SyncInfo ¶
type SyncInfo struct {
Height uint64
Block *block.Block
Bts []*block.BlockTransaction
Ptx *ballot.ProposerTransaction
// Fetching target node addresses, NodeList is the validators which
// participated and confirmed the consensus of latest ballot.
NodeList *NodeList
}
type SyncProgress ¶
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
func NewSyncer ¶
func NewSyncer( f Fetcher, v Validator, st *storage.LevelDBBackend, opts ...SyncerOption) *Syncer
func (*Syncer) SetSyncTargetBlock ¶
func (*Syncer) SyncProgress ¶
func (s *Syncer) SyncProgress(ctx context.Context) (*SyncProgress, error)
type SyncerOption ¶
type SyncerOption func(s *Syncer)
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶
func NewWatcher( syncer SyncController, client Doer, cm network.ConnectionManager, st *storage.LevelDBBackend, ln *node.LocalNode, opts ...WatcherOption) *Watcher
type WatcherOption ¶
type WatcherOption func(*Watcher)
Click to show internal directories.
Click to hide internal directories.