baseminer

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilTask is an error for nil task
	ErrNilTask = errors.New("nil task")
	// ErrParserTasksWasClosed is an error for closed tasks
	ErrParserTasksWasClosed = errors.New("tasks was closed")
)
View Source
var (
	// ErrSrcDataClosed is an error for closed src data
	ErrSrcDataClosed = errors.New("source of src data was closed")
	// ErrSrcDataIsNil is an error for nil src data
	ErrSrcDataIsNil = errors.New("src data is nil")
)
View Source
var ErrSaverTasksWasClosed = errors.New("tasks was closed")

ErrSaverTasksWasClosed is an error for closed tasks

Functions

This section is empty.

Types

type DataParser

type DataParser[TSrcData any, TPreSaverData any] interface {
	Parse(ctx context.Context, data *TSrcData) (*TPreSaverData, error)
}

DataParser is a type for data parsers

type DataSource

type DataSource[TSrcData any] interface {
	SrcData() <-chan *TSrcData
	Close()
}

DataSource is a type for data sources

type MHandler

type MHandler[TCheckPoint any, TSrcData any, TPreSaverData any, TSaverData any] struct {
	// contains filtered or unexported fields
}

MHandler is a type for metrics handler

func NewMHandler

func NewMHandler[TCheckPoint any, TSrcData any, TPreSaverData any, TSaverData any](ctx context.Context,
	stor Storage[TCheckPoint, TSaverData],
	createSrc func(ctx context.Context, startFromChp *TCheckPoint) (DataSource[TSrcData], error),
	parser DataParser[TSrcData, TPreSaverData],
	createPreSaver func(ctx context.Context) (PreSaver[TCheckPoint, TPreSaverData, TSaverData], error),
	parserPoolCountWorkers, saverTasksBufSize, saverMaxBatchSize uint,
) *MHandler[TCheckPoint, TSrcData, TPreSaverData, TSaverData]

NewMHandler creates a new metrics handler

func (*MHandler[TCheckPoint, TSrcData, TPreSaverData, TSaverData]) RunHandler

func (mh *MHandler[TCheckPoint, TSrcData, TPreSaverData, TSaverData]) RunHandler(ctx context.Context) error

RunHandler runs metrics handler

type PreSaver

type PreSaver[TCheckPoint any, TPreSaverData any, TSaverData any] interface {
	PreSaveProcess(ctx context.Context, prevChp *TCheckPoint, data []*TPreSaverData) (TCheckPoint, *TSaverData, error)
}

PreSaver is a type for pre-savers

type Storage

type Storage[TCheckPoint any, TSaverData any] interface {
	Save(ctx context.Context, chp TCheckPoint, data *TSaverData) (TCheckPoint, error)
	FindCheckPoint(ctx context.Context) (*TCheckPoint, bool, error)
}

Storage is a type for storages

Jump to

Keyboard shortcuts

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