bill

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CRC16("github.com/privatix/dappctrl/client/bill") = 0xEB0A
	ErrAlreadyRunning errors.Error = 0xEB0A<<8 + iota
	ErrMonitorClosed
	ErrGetConsumedUnits
	ErrGetOffering
	ErrUpdateReceiptBalance
)

Errors.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CollectPeriod  uint // In milliseconds.
	RequestTLS     bool
	RequestTimeout uint // In milliseconds, must be less than CollectPeriod.
}

Config is a billing monitor configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a new billing monitor configuration.

type Monitor

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

Monitor is a client billing monitor.

func NewMonitor

func NewMonitor(conf *Config, logger log.Logger, db *reform.DB, suggestor PriceSuggestor,
	pr *proc.Processor, queue job.Queue, pscAddr string, pw data.PWDGetter) *Monitor

NewMonitor creates a new client billing monitor.

func (*Monitor) Close

func (m *Monitor) Close()

Close causes currently running Run() function to exit.

func (*Monitor) Run

func (m *Monitor) Run() error

Run processes billing for active client channels. This function does not return until an error occurs or Close() is called.

type PriceSuggestor added in v1.1.0

type PriceSuggestor interface {
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
}

PriceSuggestor suggests best gas price for current moment.

Jump to

Keyboard shortcuts

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