scan

package
v1.0.0-beta.1.0...-bf02ba7 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is for requests that 404'd from Blizzard's API. This happens periodically for valid requests.

Functions

func Scan

func Scan[T any](scanner *Scanner, requests <-chan bnet.Request, results chan<- ScanResult[T], options *ScanOptions[T])

Types

type FuncResultProcessor

type FuncResultProcessor[T any] struct {
	Func func(*T) error
}

func (FuncResultProcessor[T]) Process

func (r FuncResultProcessor[T]) Process(t *T) error

type ResultProcessor

type ResultProcessor[T any] interface {
	Process(*T) error
}

func NewResultProcessor

func NewResultProcessor[T any](f func(*T) error) ResultProcessor[T]

type ScanOptions

type ScanOptions[T any] struct {
	Validator validate.Validator[T]
	Filters   []ResultProcessor[T]
	Repairs   []ResultProcessor[T]
	Lifespan  time.Duration
}

type ScanResult

type ScanResult[T any] struct {
	Response   T
	Error      error
	ApiRequest bnet.Request
	Index      int64
	Details    ScanResultDetails
}

func ScanSingle

func ScanSingle[T any](scanner *Scanner, request bnet.Request, options *ScanOptions[T]) ScanResult[T]

type ScanResultDetails

type ScanResultDetails struct {
	Cached      bool
	ApiAttempts int
	ApiErrors   int
	Repaired    bool
	Success     bool
}

type Scanner

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

Scanner is a utility for querying and caching responses from the Blizzard API.

func NewScanner

func NewScanner(storage storage.ResponseStorage, client *bnet.Client, opts ...ScannerOption) (*Scanner, error)

type ScannerOption

type ScannerOption interface {
	// contains filtered or unexported methods
}

func WithMaxRetries

func WithMaxRetries(retries int) ScannerOption

func WithMetrics

func WithMetrics(meter metric.Meter) ScannerOption

Jump to

Keyboard shortcuts

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