tweetfinder

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTops   = errors.New("no top tweets")
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type ConfigPool

type ConfigPool struct {
	Proxies []string `envconfig:"PROXIES"`
}

func GetConfigPool

func GetConfigPool() ConfigPool

type Finder

type Finder interface {
	FindAll(ctx context.Context, start, end *time.Time, search string) ([]common.TweetSnapshot, error)
	Find(ctx context.Context, id string) (*common.TweetSnapshot, error)
	CurrentDelay() int64
	Init(ctx context.Context) error
}

func NewFinder

func NewFinder(scraper *twitterscraper.Scraper, delayManager delayManager, logger log.Logger) Finder

func NewMetricMiddleware

func NewMetricMiddleware(all, one *prometheus.HistogramVec, login string, next Finder) Finder

func NewPool

func NewPool(metricsAll, metricsOne *prometheus.HistogramVec, config ConfigPool, manager accountManager, db repo, logger log.Logger) Finder

type Manager

type Manager interface {
	TooManyRequests(ctx context.Context)
	AfterRequest()
	ProcessedQuery()
	SetSetterFn(func(seconds int64))
	CurrentDelay() int64
	Start(ctx context.Context) error
}

func NewDelayManagerV2

func NewDelayManagerV2(
	setter func(seconds int64),
	windowLimiters []WindowLimiter,
	minimalDelay int64,
	log log.Logger,
) Manager

type WindowLimiter

type WindowLimiter interface {
	Inc()
	TrySetThreshold(ctx context.Context, startTime time.Time) error
	Duration() time.Duration
	TooFast(ctx context.Context) (uint64, error)
	SetResetLimiter(resetLimiter windowlimiter.ResetLimiter)
	Threshold(ctx context.Context) uint64
	Start(ctx context.Context, delay int64) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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