store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStore

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

func (*PostgresStore) CommitBlock

func (s *PostgresStore) CommitBlock(ctx context.Context, block uint64) error

func (*PostgresStore) GetMissingBlocks

func (s *PostgresStore) GetMissingBlocks(ctx context.Context, lowerBound uint64, upperBound uint64) (pgx.Rows, error)

func (*PostgresStore) GetSearchBounds

func (s *PostgresStore) GetSearchBounds(ctx context.Context, batchSize uint64, headCursor uint64, headBlockLag uint64) (uint64, uint64, error)

func (*PostgresStore) SetSearchLowerBound

func (s *PostgresStore) SetSearchLowerBound(ctx context.Context, newLowerBound uint64) error

type PostgresStoreOpts

type PostgresStoreOpts struct {
	DSN                  string
	MigrationsFolderPath string
	InitialLowerBound    uint64
	Logg                 logf.Logger
	Queries              goyesql.Queries
}

type Store

type Store[T any] interface {
	GetSearchBounds(ctx context.Context, batchSize uint64, headCursor uint64, headBlockLag uint64) (lowerBound uint64, upperBound uint64, err error)
	GetMissingBlocks(ctx context.Context, lowerBound uint64, upperBound uint64) (missingBlocksIterable T, err error)
	SetSearchLowerBound(ctx context.Context, newLowerBound uint64) (err error)
	CommitBlock(ctx context.Context, block uint64) (err error)
}

Store defines all relevant get/set queries against the implemented storage backend.

func NewPostgresStore

func NewPostgresStore(o PostgresStoreOpts) (Store[pgx.Rows], error)

Jump to

Keyboard shortcuts

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