batchservice

package
v2.8.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: BSD-3-Clause Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInterruped = errors.New("postage sync interrupted")
View Source
var ErrZeroValueBatch = errors.New("low balance batch")

Functions

This section is empty.

Types

type Interface

type Interface interface {
	postage.EventUpdater
}

func New

func New(
	ctx context.Context,
	stateStore storage.StateStorer,
	storer postage.Storer,
	logger log.Logger,
	listener postage.Listener,
	owner []byte,
	batchListener postage.BatchEventListener,
	checksumFunc func() hash.Hash,
	snapshot *Snapshot,
	resync bool,
) (Interface, bool, error)

New will create a new BatchService.

The batch store is reset here, in the constructor, when a resync was requested or a dirty shutdown was detected. A provided snapshot is then replayed onto the (possibly reset) store; if that replay fails the store is reset again so live sync can rebuild it from the chain. Start never resets the store. The returned bool reports whether the snapshot was replayed successfully.

type Snapshot added in v2.8.1

type Snapshot struct {
	// Listener replays the snapshot's events into the batch store.
	Listener postage.Listener
	// StartBlock is the block height from which the snapshot is replayed (the
	// postage contract start block).
	StartBlock uint64
	// ResumeBlock is the block height the snapshot reached, from which live sync
	// resumes once the replay completes.
	ResumeBlock uint64
}

Snapshot carries the optional inputs needed to rebuild the batch store from a postage snapshot. When passed to New (non-nil), the store is reset and replayed from the snapshot before the service is returned, and live sync later resumes from the snapshot's block height. New takes ownership of Listener and closes it once the snapshot has been replayed.

Jump to

Keyboard shortcuts

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