Documentation
¶
Index ¶
- func NewMainTrieTask(sync *stateSync) syncTask
- func NewStorageTrieTask(sync *stateSync, root common.Hash, accounts []common.Hash) syncTask
- func NewSyncer(client syncclient.Client, db ethdb.Database, root common.Hash, ...) (syncpkg.Syncer, error)
- func NewTrieQueue(db ethdb.Database) *trieQueue
- func NewTrieToSync(sync *stateSync, root common.Hash, account common.Hash, syncTask syncTask) (*trieToSync, error)
- type CodeQueue
- type CodeQueueOption
- type CodeSyncer
- type CodeSyncerOption
- type SyncerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMainTrieTask ¶ added in v0.8.14
func NewMainTrieTask(sync *stateSync) syncTask
func NewStorageTrieTask ¶ added in v0.8.14
func NewTrieQueue ¶ added in v0.8.14
Types ¶
type CodeQueue ¶ added in v0.15.4
type CodeQueue struct {
// contains filtered or unexported fields
}
CodeQueue implements the producer side of code fetching. It accepts code hashes, persists durable "to-fetch" markers (idempotent per hash), and enqueues the hashes as-is onto an internal channel consumed by the code syncer. The queue does not perform in-memory deduplication or local-code checks - that is the responsibility of the consumer.
func NewCodeQueue ¶ added in v0.15.4
func NewCodeQueue(db ethdb.Database, quit <-chan struct{}, opts ...CodeQueueOption) (*CodeQueue, error)
NewCodeQueue creates a new code queue applying optional functional options. The `quit` channel, if non-nil, MUST eventually be closed to avoid leaking a goroutine.
func (*CodeQueue) AddCode ¶ added in v0.15.4
AddCode persists and enqueues new code hashes. Persists idempotent "to-fetch" markers for all inputs and enqueues them as-is. Returns errAddCodeAfterFinalize after a clean finalize and errFailedToAddCodeHashesToQueue on early quit.
func (*CodeQueue) CodeHashes ¶ added in v0.15.4
CodeHashes returns the receive-only channel of code hashes to consume.
type CodeQueueOption ¶ added in v0.15.4
func WithCapacity ¶ added in v0.15.4
func WithCapacity(n int) CodeQueueOption
WithCapacity overrides the queue buffer capacity.
type CodeSyncer ¶ added in v0.15.4
type CodeSyncer struct {
// contains filtered or unexported fields
}
CodeSyncer syncs code bytes from the network in a separate thread. It consumes code hashes from a queue and persists code into the DB. Outstanding requests are tracked via durable "to-fetch" markers in the DB for recovery. The syncer performs in-flight deduplication and skips locally-present code before issuing requests.
func NewCodeSyncer ¶ added in v0.15.4
func NewCodeSyncer(client statesyncclient.Client, db ethdb.Database, codeHashes <-chan common.Hash, opts ...CodeSyncerOption) (*CodeSyncer, error)
NewCodeSyncer allows external packages (e.g., registry wiring) to create a code syncer that consumes hashes from a provided fetcher queue.
func (*CodeSyncer) ID ¶ added in v0.15.4
func (*CodeSyncer) ID() string
ID returns the stable identifier for this sync task.
func (*CodeSyncer) Name ¶ added in v0.15.4
func (*CodeSyncer) Name() string
Name returns the human-readable name for this sync task.
func (*CodeSyncer) Sync ¶ added in v0.15.4
func (c *CodeSyncer) Sync(ctx context.Context) error
Sync starts the worker thread and populates the code hashes queue with active work. Blocks until all outstanding code requests from a previous sync have been fetched and the code channel has been closed, or the context is cancelled.
type CodeSyncerOption ¶ added in v0.15.4
CodeSyncerOption configures CodeSyncer at construction time.
func WithCodeHashesPerRequest ¶ added in v0.15.4
func WithCodeHashesPerRequest(n int) CodeSyncerOption
WithCodeHashesPerRequest sets the best-effort target batch size per request. The final batch may contain fewer than the configured number if insufficient hashes remain when the channel is closed.
func WithNumWorkers ¶ added in v0.15.4
func WithNumWorkers(n int) CodeSyncerOption
WithNumWorkers overrides the number of concurrent workers.
type SyncerOption ¶ added in v0.15.4
SyncerOption configures the state syncer via functional options.
func WithBatchSize ¶ added in v0.15.4
func WithBatchSize(n uint) SyncerOption
WithBatchSize sets the database batch size for writes.