push

package
v1.34.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPushMode = errors.New("invalid push mode")

Functions

func Module

func Module() fx.Option

Types

type BlacklistOperation added in v1.21.0

type BlacklistOperation string
const (
	BlacklistOperationAdded   BlacklistOperation = "added"
	BlacklistOperationSkipped BlacklistOperation = "skipped"
)

type Config

type Config struct {
	Mode Mode

	ClientOptions map[string]string

	Debounce time.Duration
	Timeout  time.Duration
}

type Event

type Event = client.Event

type Mode

type Mode string
const (
	ModeFCM      Mode = "fcm"
	ModeUpstream Mode = "upstream"
)

type Service

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

func New

func New(
	config Config,
	client client.Client,
	cacheFactory cache.Factory,
	metrics *metrics,
	logger *zap.Logger,
) (*Service, error)

func (*Service) Enqueue

func (s *Service) Enqueue(token string, event Event) error

Enqueue adds the data to the cache and immediately sends all messages if the debounce is 0.

func (*Service) Run

func (s *Service) Run(ctx context.Context)

Run starts a ticker that triggers the sendAll function every debounce interval. It runs indefinitely until the provided context is canceled.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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