sync

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: GPL-3.0, LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

View Source
const (

	// TrieNode represents a leaf node that belongs to the atomic trie.
	TrieNode message.NodeType = 2
)

Variables

This section is empty.

Functions

func NewLeafHandler

func NewLeafHandler() *leafHandler

NewAtomicLeafHandler returns a new uninitialized leafHandler that can be later initialized

func NewSummaryParser

func NewSummaryParser() *summaryParser

Types

type Extender added in v0.15.4

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

Extender is the sync extender for the atomic VM.

func (*Extender) CreateSyncer added in v0.15.4

func (a *Extender) CreateSyncer(client syncclient.LeafClient, verDB *versiondb.Database, summary message.Syncable) (sync.Syncer, error)

CreateSyncer creates the atomic syncer with the given client and verDB.

func (*Extender) Initialize added in v0.15.4

func (a *Extender) Initialize(backend *state.AtomicBackend, trie *state.AtomicTrie, requestSize uint16)

Initialize initializes the sync extender with the backend and trie and request size.

func (*Extender) OnFinishAfterCommit added in v0.15.4

func (a *Extender) OnFinishAfterCommit(summaryHeight uint64) error

OnFinishAfterCommit implements the sync.Extender interface by applying the atomic trie to the shared memory.

func (*Extender) OnFinishBeforeCommit added in v0.15.4

func (a *Extender) OnFinishBeforeCommit(lastAcceptedHeight uint64, summary message.Syncable) error

OnFinishBeforeCommit implements the sync.Extender interface by marking the previously last accepted block for the shared memory cursor.

type Summary

type Summary struct {
	*message.BlockSyncSummary `serialize:"true"`
	AtomicRoot                common.Hash `serialize:"true"`
	// contains filtered or unexported fields
}

Summary provides the information necessary to sync a node starting at the given block.

func NewSummary

func NewSummary(blockHash common.Hash, blockNumber uint64, blockRoot common.Hash, atomicRoot common.Hash) (*Summary, error)

func (*Summary) Accept

func (*Summary) Bytes

func (a *Summary) Bytes() []byte

func (*Summary) ID

func (a *Summary) ID() ids.ID

func (*Summary) String

func (a *Summary) String() string

type SummaryProvider added in v0.15.4

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

SummaryProvider is the summary provider that provides the state summary for the atomic trie.

func (*SummaryProvider) Initialize added in v0.15.4

func (a *SummaryProvider) Initialize(trie *state.AtomicTrie)

Initialize initializes the summary provider with the atomic trie.

func (*SummaryProvider) StateSummaryAtBlock added in v0.15.4

func (a *SummaryProvider) StateSummaryAtBlock(blk *types.Block) (block.StateSummary, error)

StateSummaryAtBlock returns the block state summary at [blk] if valid.

type Syncer

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

Syncer is used to sync the atomic trie from the network. The CallbackLeafSyncer is responsible for orchestrating the sync while Syncer is responsible for maintaining the state of progress and writing the actual atomic trie to the trieDB.

func NewSyncer added in v0.15.4

func NewSyncer(client syncclient.LeafClient, db *versiondb.Database, atomicTrie *atomicstate.AtomicTrie, targetRoot common.Hash, targetHeight uint64, opts ...SyncerOption) (*Syncer, error)

NewSyncer returns a new syncer instance that will sync the atomic trie from the network.

func (*Syncer) ID added in v0.15.4

func (*Syncer) ID() string

ID returns the stable identifier for this sync task.

func (*Syncer) Name added in v0.15.4

func (*Syncer) Name() string

Name returns the human-readable name for this sync task.

func (*Syncer) Sync added in v0.15.4

func (s *Syncer) Sync(ctx context.Context) error

Sync begins syncing the target atomic root with the configured number of worker goroutines.

type SyncerOption added in v0.15.4

type SyncerOption = options.Option[config]

SyncerOption configures the atomic syncer via functional options.

func WithNumWorkers added in v0.15.4

func WithNumWorkers(n int) SyncerOption

WithNumWorkers sets the number of worker goroutines for syncing.

func WithRequestSize added in v0.15.4

func WithRequestSize(n uint16) SyncerOption

WithRequestSize sets the request size per network call.

Jump to

Keyboard shortcuts

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