services

package
v0.0.0-...-0250509 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeedbackCollector

type FeedbackCollector interface {
	TokenInvalid(serviceID, token string)
	ReplaceToken(serviceID, token, replacement string)
	CountPush(serviceID string, success bool, duration time.Duration)
}

FeedbackCollector ...

type Pump

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

func NewPump

func NewPump(workers int, squash SquashConfig, adapter PumpAdapter) (p *Pump)

NewPump

func (*Pump) Serve

func (p *Pump) Serve(ctx context.Context, q queue.Queue, fc FeedbackCollector) (err error)

type PumpAdapter

type PumpAdapter interface {
	ConvertMessage([]byte) (ServiceMessage, error)
	NewClient() (PumpClient, error)
	PushMessage(client PumpClient, smsg ServiceMessage, fc FeedbackCollector) PushStatus
	SquashAndPushMessage(client PumpClient, smsgs []ServiceMessage, fc FeedbackCollector) PushStatus
	Logger() *slog.Logger
}

type PumpClient

type PumpClient interface {
}

type PushService

type PushService interface {
	PumpAdapter
	fmt.Stringer
	ID() string
	Validate([]byte) error
}

PushService ...

type PushStatus

type PushStatus int
const (
	// PushStatusSuccess ...
	PushStatusSuccess PushStatus = iota
	// PushStatusTempFail signals a failure that may be resolved by retrying
	PushStatusTempFail
	// PushStatusHardFail signals a failure for which a retry would not hekp
	PushStatusHardFail
)

type ServiceMessage

type ServiceMessage interface {
	GetSquashKey() string
}

type SquashConfig

type SquashConfig struct {
	RateMax int
	RatePer time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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