enriching

package
v2.0.0-...-91315bd Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEnrichmentCall is returned when the webhook call fails on the side of the webhook.
	ErrEnrichmentCall = errors.New("the call to the webhook returned an error response")

	// ErrEnrichmentInternal is returned when the enrichment fails for an internal reason.
	ErrEnrichmentInternal = errors.New("could not perform enrichment")
)

Functions

This section is empty.

Types

type Enricher

type Enricher interface {
	// Enrich enriches the members list with some metadata.
	// Returns the members list with the metadata field filled.
	Enrich(ctx context.Context, tenantID, leaderboardID string, members []*model.Member) ([]*model.Member, error)
}

func NewEnricher

func NewEnricher(
	options ...EnricherOptions,
) Enricher

NewEnricher returns a new Enricher implementation.

func NewInstrumentedEnricher

func NewInstrumentedEnricher(
	impl Enricher,
	metricsReporter extensions.MetricsReporter,
) Enricher

type EnricherCache

type EnricherCache interface {
	// Get checks the cache for the enrichment metadata of the members.
	// Returns a map with the member's publicID as key and the metadata as value.
	// Returns true if all the members are found, false if one or more are not.
	Get(ctx context.Context, tenantID string, members []*model.Member) (map[string]map[string]string, bool, error)

	// Set sets the enrichment metadata of the members in the cache.
	Set(ctx context.Context, tenantID string, members []*model.Member, ttl time.Duration) error
}

type EnricherOptions

type EnricherOptions func(*enricherImpl)

func WithCloudSaveEnabled

func WithCloudSaveEnabled(enabled map[string]bool) EnricherOptions

WithCloudSaveEnabled sets the map of enabled Cloud Save for each tenantID.

func WithCloudSaveUrl

func WithCloudSaveUrl(url string) EnricherOptions

WithCloudSaveUrl sets the Cloud Save URL.

func WithLogger

func WithLogger(logger *zap.Logger) EnricherOptions

WithLogger sets the logger.

func WithWebhookTimeout

func WithWebhookTimeout(timeout time.Duration) EnricherOptions

WithWebhookTimeout sets the webhook timeout.

func WithWebhookUrls

func WithWebhookUrls(urlsMap map[string]string) EnricherOptions

WithWebhookUrls sets the map of webhook URL for each tenantID.

Directories

Path Synopsis
proto
webhook/v1
Package podium_leaderboard_webhooks_v1 is a reverse proxy.
Package podium_leaderboard_webhooks_v1 is a reverse proxy.

Jump to

Keyboard shortcuts

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