data_aggregation

package
v0.0.0-...-a7a2cce Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package data_aggregation pulls data from a Riot API client and stores it in a centralized table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator aggregates match data from a client into a sink. It is illegal to construct an instance directly. Use NewAggregator to return a valid instance.

func NewAggregator

func NewAggregator(c apiclient.Client, s Sink) *Aggregator

NewAggregator returns an Aggregator configured to query the Riot API with the given client, and aggregate results into the given Sink.

func (Aggregator) AggregateChallengerLeagueMatches

func (a Aggregator) AggregateChallengerLeagueMatches(ctx context.Context, r region.Region, q queue.Queue, since time.Time) error

AggregateChallengerLeagueMatches aggregates all games from accounts currently in challenger league in the given region in queue. Only games since the given begin time are considered. The zero time value indicates that all games should be considered.

func (Aggregator) GetMatchIDsForAccounts

func (a Aggregator) GetMatchIDsForAccounts(ctx context.Context, r region.Region, q queue.Queue, since time.Time, accountIDs []string) map[int64]struct{}

func (Aggregator) UploadMatches

func (a Aggregator) UploadMatches(ctx context.Context, r region.Region, matches map[int64]struct{})

type Match

type Match struct {
	ID       int64
	Region   region.Region
	Match    *apiclient.Match
	Timeline *apiclient.MatchTimeline
}

Match is the serialized format of match data. Match or Timeline may be nil if the data is unavailable from the API. Matches are unique by ID and Region.

type Sink

type Sink interface {
	// MatchExists returns true if the match ID for the given region is already
	// stored in the sink.
	MatchExists(ctx context.Context, r region.Region, id int64) (bool, error)

	// SaveMatches saves the matches into the sink. It is not an error to save a
	// match that has already been saved. Sink must not duplicate the match, but
	// may either ignore or update the saved match.
	SaveMatches(ctx context.Context, m []Match) error
}

Sink stores match data in an aggregate source.

Directories

Path Synopsis
Package bigquery_aggregator uploads data to BigQuery.
Package bigquery_aggregator uploads data to BigQuery.

Jump to

Keyboard shortcuts

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