confirmer

package
v0.0.0-...-1bfa4a9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPollInterval = 30 * time.Second
	DefaultExpiry       = 30 * 24 * time.Hour
)

Enumerate default options.

Functions

This section is empty.

Types

type Confirmer

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

Confirmer handles requests that have been validated. It checks if requests have reached sufficient confirmations and stores those that have not to be checked later.

func New

func New(options Options, dispatcher phi.Sender, db db.DB, bindings binding.Bindings) Confirmer

New returns a new Confirmer.

func (*Confirmer) Run

func (confirmer *Confirmer) Run(ctx context.Context)

Run starts running the confirmer in the background which periodically checks confirmations for pending transactions and prunes old transactions.

type Options

type Options struct {
	Logger       logrus.FieldLogger
	PollInterval time.Duration
	Expiry       time.Duration
}

Options to configure the precise behaviour of the confirmer.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns new options with default configurations that should work for the majority of use cases.

func (Options) WithExpiry

func (opts Options) WithExpiry(expiry time.Duration) Options

WithExpiry returns new options with the given transaction expiry.

func (Options) WithLogger

func (opts Options) WithLogger(logger logrus.FieldLogger) Options

WithLogger returns new options with the given logger.

func (Options) WithPollInterval

func (opts Options) WithPollInterval(pollInterval time.Duration) Options

WithPollInterval returns new options with the given poll interval.

Jump to

Keyboard shortcuts

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