persistence

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHtlcAlreadySettled = errors.New("htlc already settled")

Functions

This section is empty.

Types

type Invoice

type Invoice struct {
	InvoiceCreationData

	SequenceNum       uint64
	SettleRequestedAt time.Time
	SettledAt         time.Time
	Settled           bool
}

type InvoiceCreationData

type InvoiceCreationData struct {
	types.InvoiceCreationData
}

type InvoiceState

type InvoiceState int
const (
	InvoiceStateAccepted InvoiceState = iota
	InvoiceStateSettleRequested
)

type PostgresPersister

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

PostgresPersister persists items to Postgres

func NewPostgresPersisterFromDSN

func NewPostgresPersisterFromDSN(dsn string, logger *zap.SugaredLogger) (
	*PostgresPersister, error)

NewPostgresPersisterFromDSN creates a new PostgresPersister using the dsn provided

func NewPostgresPersisterFromOptions

func NewPostgresPersisterFromOptions(options *pg.Options,
	logger *zap.SugaredLogger) *PostgresPersister

NewPostgresPersisterFromOptions creates a new PostgresPersister using the options provided

func (*PostgresPersister) Close

func (p *PostgresPersister) Close() error

func (*PostgresPersister) Get

func (*PostgresPersister) GetInvoices

func (p *PostgresPersister) GetInvoices(ctx context.Context,
	maxInvoicesCount, sequenceStart int) ([]*Invoice, error)

func (*PostgresPersister) MarkHtlcSettled

func (p *PostgresPersister) MarkHtlcSettled(ctx context.Context,
	key types.HtlcKey) (bool, error)

func (*PostgresPersister) Ping

func (p *PostgresPersister) Ping(ctx context.Context) error

Ping pings the database connection to ensure it is available

func (*PostgresPersister) RequestSettle

func (p *PostgresPersister) RequestSettle(ctx context.Context,
	invoice *InvoiceCreationData, htlcs map[types.HtlcKey]int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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