balanceworker

package
v1.0.0-beta.135 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceWorkerRepository

type BalanceWorkerRepository interface {
	ListAffectedEntitlements(ctx context.Context, filterPairs []IngestEventQueryFilter) ([]IngestEventDataResponse, error)
}

type IngestEventDataResponse

type IngestEventDataResponse struct {
	Namespace     string
	EntitlementID string
	SubjectKey    string
	// not all entitlements have a meter associated
	MeterSlug *string
}

type IngestEventQueryFilter

type IngestEventQueryFilter struct {
	Namespace  string
	SubjectKey string
	MeterSlugs []string
}

type NamespacedID

type NamespacedID = pkgmodels.NamespacedID

type SubjectIDResolver

type SubjectIDResolver interface {
	GetSubjectIDByKey(ctx context.Context, namespace, key string) (string, error)
}

type Worker

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

func New

func New(opts WorkerOptions) (*Worker, error)

func (*Worker) Close

func (w *Worker) Close() error

func (*Worker) GetEntitlementsAffectedByMeterSubject

func (w *Worker) GetEntitlementsAffectedByMeterSubject(ctx context.Context, namespace string, meterSlugs []string, subject string) ([]NamespacedID, error)

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

type WorkerDLQOptions

type WorkerDLQOptions struct {
	Topic            string
	Throttle         bool
	ThrottleDuration time.Duration
	ThrottleCount    int64
}

type WorkerOptions

type WorkerOptions struct {
	SystemEventsTopic string
	IngestEventsTopic string
	Subscriber        message.Subscriber

	TargetTopic string
	DLQ         *WorkerDLQOptions
	Publisher   message.Publisher
	Marshaler   publisher.CloudEventMarshaler

	Entitlement *registry.Entitlement
	Repo        BalanceWorkerRepository
	// External connectors
	SubjectIDResolver SubjectIDResolver

	Logger *slog.Logger
}

Jump to

Keyboard shortcuts

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