storage

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI            string `env:"MONGO_CRAWLER_URI"`
	User           string `env:"MONGO_USER"`
	Password       string `env:"MONGO_PASSWORD"`
	MaxPoolSize    uint64 `env:"MAX_POOL_SIZE" envDefault:"8"`
	MaxConnecting  uint64 `env:"MAX_CONNECTING" envDefault:"8"`
	MetricsEnabled bool   `env:"METRICS_ENABLED" envDefault:"false"`
}

type Storage

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

func New

func New(cfg Config, l zerolog.Logger) *Storage

func (*Storage) CountErrorMessages

func (s *Storage) CountErrorMessages(ctx context.Context) (int64, error)

func (*Storage) CountErrorTxs

func (s *Storage) CountErrorTxs(ctx context.Context) (int64, error)

func (*Storage) CreateBlock

func (s *Storage) CreateBlock(ctx context.Context, block *model.Block) error

func (*Storage) GetAllBlocks

func (s *Storage) GetAllBlocks(ctx context.Context) (blocks []*model.Block, err error)

func (*Storage) GetBlockByHeight

func (s *Storage) GetBlockByHeight(ctx context.Context, height int64) (*model.Block, error)

func (*Storage) GetErrorBlockHeights

func (s *Storage) GetErrorBlockHeights(ctx context.Context) ([]int64, error)

func (*Storage) GetLatestBlock

func (s *Storage) GetLatestBlock(ctx context.Context) (*model.Block, error)

func (*Storage) InsertErrorMessage

func (s *Storage) InsertErrorMessage(ctx context.Context, message model.Message) error

func (*Storage) InsertErrorTx

func (s *Storage) InsertErrorTx(ctx context.Context, tx model.Tx) error

func (*Storage) Ping

func (s *Storage) Ping(ctx context.Context) error

func (*Storage) SetErrorStatus

func (s *Storage) SetErrorStatus(ctx context.Context, height int64, msg string) error

func (*Storage) SetProcessedStatus

func (s *Storage) SetProcessedStatus(ctx context.Context, height int64) error

func (*Storage) Start

func (s *Storage) Start(ctx context.Context) error

func (*Storage) Stop

func (s *Storage) Stop(ctx context.Context) error

func (*Storage) UpdateStatus

func (s *Storage) UpdateStatus(ctx context.Context, height int64, status model.Status) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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