workers

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package workers implements the attestation worker for the payer report.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttestationWorker

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

AttestationWorker is responsible for periodically checking for reports that need attestation and signing them with the node's private key.

func NewAttestationWorker

func NewAttestationWorker(
	ctx context.Context,
	log *zap.Logger,
	registrant registrant.IRegistrant,
	store payerreport.IPayerReportStore,
	pollInterval time.Duration,
	domainSeparator common.Hash,
) *AttestationWorker

NewAttestationWorker creates and starts a new attestation worker that will periodically check for reports that need attestation. It takes a context, logger, registrant for signing, store for accessing reports, and a poll interval that determines how often to check for reports.

func (*AttestationWorker) AttestReports

func (w *AttestationWorker) AttestReports() error

AttestReports fetches all reports with pending attestation status and attempts to attest each one. Returns an error if there was a problem fetching the reports.

func (*AttestationWorker) Start

func (w *AttestationWorker) Start()

Start launches the worker's main loop in a separate goroutine. The loop periodically checks for reports that need attestation.

func (*AttestationWorker) Stop

func (w *AttestationWorker) Stop()

type GeneratorWorker

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

func NewGeneratorWorker

func NewGeneratorWorker(
	ctx context.Context,
	log *zap.Logger,
	store payerreport.IPayerReportStore,
	registry registry.NodeRegistry,
	registrant registrant.IRegistrant,
	minReportInterval time.Duration,
	domainSeparator common.Hash,
) *GeneratorWorker

func (*GeneratorWorker) GenerateReports

func (w *GeneratorWorker) GenerateReports() error

func (*GeneratorWorker) Start

func (w *GeneratorWorker) Start()

func (*GeneratorWorker) Stop

func (w *GeneratorWorker) Stop()

type SubmitterWorker

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

func NewSubmitterWorker

func NewSubmitterWorker(
	ctx context.Context,
	log *zap.Logger,
	payerReportStore payerreport.IPayerReportStore,
	registry registry.NodeRegistry,
	reportsManager blockchain.PayerReportsManager,
	myNodeID uint32,
) *SubmitterWorker

func (*SubmitterWorker) Start

func (w *SubmitterWorker) Start()

func (*SubmitterWorker) Stop

func (w *SubmitterWorker) Stop() error

func (*SubmitterWorker) SubmitReports

func (w *SubmitterWorker) SubmitReports(ctx context.Context) error

Jump to

Keyboard shortcuts

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