services

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheAvailability added in v0.3.0

func CacheAvailability[A share.Availability](lc fx.Lifecycle, ds datastore.Batching, avail A) share.Availability

CacheAvailability wraps either Full or Light availability with a cache for result sampling.

func DASer

func DASer(
	ctx context.Context,
	lc fx.Lifecycle,
	avail share.Availability,
	sub header.Subscriber,
	hstore header.Store,
	ds datastore.Batching,
	fservice fraud.Service,
) *das.DASer

DASer constructs a new Data Availability Sampler.

func FraudLifecycle added in v0.3.0

func FraudLifecycle(
	startCtx, lifecycleCtx context.Context,
	p fraud.ProofType,
	fservice fraud.Service,
	start, stop func(context.Context) error,
) error

FraudLifecycle controls the lifecycle of service depending on fraud proofs. It starts the service only if no fraud-proof exists and stops the service automatically if a proof arrives after the service was started.

func FraudService added in v0.3.0

func FraudService(
	lc fx.Lifecycle,
	sub *pubsub.PubSub,
	host host.Host,
	hstore header.Store,
	ds datastore.Batching,
) (fraud.Service, error)

FraudService constructs a fraud proof service with the syncer disabled.

func FraudServiceWithSyncer added in v0.3.0

func FraudServiceWithSyncer(
	lc fx.Lifecycle,
	sub *pubsub.PubSub,
	host host.Host,
	hstore header.Store,
	ds datastore.Batching,
) (fraud.Service, error)

FraudServiceWithSyncer constructs fraud proof service with enabled syncer.

func FullAvailability added in v0.2.0

func FullAvailability(cfg Config) func(
	lc fx.Lifecycle,
	bServ blockservice.BlockService,
	r routing.ContentRouting,
	h host.Host,
) *share.FullAvailability

FullAvailability constructs full share availability.

func HeaderExchangeP2P

func HeaderExchangeP2P(cfg Config) func(params.Bootstrappers, host.Host) (header.Exchange, error)

HeaderExchangeP2P constructs new Exchange for headers.

func HeaderP2PExchangeServer added in v0.2.0

func HeaderP2PExchangeServer(lc fx.Lifecycle, host host.Host, store header.Store) *p2p.ExchangeServer

HeaderP2PExchangeServer creates a new header/p2p.ExchangeServer.

func HeaderService

func HeaderService(
	syncer *sync.Syncer,
	sub header.Subscriber,
	p2pServer *p2p.ExchangeServer,
	ex header.Exchange,
	store header.Store,
) *headerservice.Service

HeaderService creates a new header.Service.

func HeaderStore

func HeaderStore(lc fx.Lifecycle, ds datastore.Batching) (header.Store, error)

HeaderStore creates and initializes new header.Store.

func HeaderStoreInit added in v0.2.0

func HeaderStoreInit(cfg *Config) func(context.Context, params.Network, header.Store, header.Exchange) error

HeaderStoreInit initializes the store.

func HeaderSyncer

func HeaderSyncer(
	ctx context.Context,
	lc fx.Lifecycle,
	ex header.Exchange,
	store header.Store,
	sub header.Subscriber,
	fservice fraud.Service,
) (*sync.Syncer, error)

HeaderSyncer creates a new Syncer.

func LightAvailability

func LightAvailability(cfg Config) func(
	lc fx.Lifecycle,
	bServ blockservice.BlockService,
	r routing.ContentRouting,
	h host.Host,
) *share.LightAvailability

LightAvailability constructs light share availability.

func Metrics added in v0.3.0

func Metrics() fx.Option

Metrics enables metrics for services.

func P2PSubscriber added in v0.2.0

func P2PSubscriber(lc fx.Lifecycle, sub *pubsub.PubSub) (*p2p.Subscriber, *p2p.Subscriber)

P2PSubscriber creates a new p2p.Subscriber.

func ShareService

func ShareService(lc fx.Lifecycle, bServ blockservice.BlockService, avail share.Availability) *share.Service

ShareService constructs new share.Service.

Types

type Config

type Config struct {
	// TrustedHash is the Block/Header hash that Nodes use as starting point for header synchronization.
	// Only affects the node once on initial sync.
	TrustedHash string
	// TrustedPeers are the peers we trust to fetch headers from.
	// Note: The trusted does *not* imply Headers are not verified, but trusted as reliable to fetch headers
	// at any moment.
	TrustedPeers []string
	// NOTE: All further fields related to share/discovery.
	// PeersLimit defines how many peers will be added during discovery.
	PeersLimit uint
	// DiscoveryInterval is an interval between discovery sessions.
	DiscoveryInterval time.Duration
	// AdvertiseInterval is a interval between advertising sessions.
	// NOTE: only full and bridge can advertise themselves.
	AdvertiseInterval time.Duration
}

func DefaultConfig

func DefaultConfig() Config

Jump to

Keyboard shortcuts

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