batchservice

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 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
}

Snapshot carries the optional inputs to rebuild the batch store from a postage snapshot. When passed to New (non-nil), the snapshot is replayed into the store before the service is returned; live sync then resumes from the last block the replay reached (held in the chain state). New owns Listener and closes it once the replay completes.

Jump to

Keyboard shortcuts

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