actsync

package
v2.1.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Size:     1000,
	Interval: 5 * time.Second,
}

DefaultConfig is the default configuration

Functions

This section is empty.

Types

type ActionSync

type ActionSync struct {
	lifecycle.Readiness
	// contains filtered or unexported fields
}

ActionSync implements the action syncer

func NewActionSync

func NewActionSync(cfg Config, helper *Helper) *ActionSync

NewActionSync creates a new action syncer

func (*ActionSync) ReceiveAction

func (as *ActionSync) ReceiveAction(_ context.Context, hash hash.Hash256)

ReceiveAction receives an action

func (*ActionSync) RequestAction

func (as *ActionSync) RequestAction(_ context.Context, hash hash.Hash256)

RequestAction requests an action by hash

func (*ActionSync) Start

func (as *ActionSync) Start(ctx context.Context) error

Start starts the action syncer

func (*ActionSync) Stop

func (as *ActionSync) Stop(ctx context.Context) error

Stop stops the action syncer

type Config

type Config struct {
	Size     int           `yaml:"syncSize"`
	Interval time.Duration `yaml:"syncInterval"`
}

Config is the configuration for action syncer

type Helper

type Helper struct {
	P2PNeighbor     Neighbors
	UnicastOutbound UniCastOutbound
}

Helper is the helper for action syncer

type Neighbors

type Neighbors func() ([]peer.AddrInfo, error)

Neighbors acquires p2p neighbors in the network

type UniCastOutbound

type UniCastOutbound func(context.Context, peer.AddrInfo, proto.Message) error

UniCastOutbound sends a unicase message to the peer

Jump to

Keyboard shortcuts

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