storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWorkerIsNotActive = errors.New("storage worker is not active")
)

Functions

This section is empty.

Types

type Adapter

type Adapter[T any] interface {
	GetInsertQuery() string
	Values(T) []any
	GetCategoryID(T) uint32
}

type Callback

type Callback func(map[uint32]GroupState)

type ClickhouseWorker

type ClickhouseWorker[T any] struct {
	// contains filtered or unexported fields
}

func NewClickhouseWorker

func NewClickhouseWorker[T any](source string, conn *sql.DB, adapter Adapter[T], maxBatchSize uint, maxBatchDuration time.Duration) *ClickhouseWorker[T]

func (*ClickhouseWorker[T]) RegisterCallback

func (w *ClickhouseWorker[T]) RegisterCallback(cb Callback)

func (*ClickhouseWorker[T]) Start

func (w *ClickhouseWorker[T]) Start(ctx context.Context) error

func (*ClickhouseWorker[T]) Store

func (w *ClickhouseWorker[T]) Store(group uint32, items ...T) error

type GroupState

type GroupState uint8
const (
	Pending GroupState = iota + 1
	Committed
	Failed
)

Jump to

Keyboard shortcuts

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