events

package
v2.32.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventListener

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

EventListener provides information about how many events a listener has processed and a mechanism to stop the listener goroutine

func NewEventListener

func NewEventListener(onSave func(), onInvalidate func()) *EventListener

NewEventListener creates a new EventListener that may perform additional work after propagating cache saves and invalidations

func SimpleEventListener

func SimpleEventListener() *EventListener

SimpleEventListener creates a new EventListener that solely propagates cache updates and invalidations

func (*EventListener) Listen

func (e *EventListener) Listen(cache stored_requests.Cache, events EventProducer)

Listen is meant to be run as a goroutine that updates/invalidates the cache when events occur

func (*EventListener) Stop

func (e *EventListener) Stop()

Stop the event listener

type EventProducer

type EventProducer interface {
	Saves() <-chan Save
	Invalidations() <-chan Invalidation
}

EventProducer will produce cache update and invalidation events on its channels

type Invalidation

type Invalidation struct {
	Requests  []string `json:"requests"`
	Imps      []string `json:"imps"`
	Accounts  []string `json:"accounts"`
	Responses []string `json:"responses"`
}

Invalidation represents a bulk invalidation

type Save

type Save struct {
	Requests  map[string]json.RawMessage `json:"requests"`
	Imps      map[string]json.RawMessage `json:"imps"`
	Accounts  map[string]json.RawMessage `json:"accounts"`
	Responses map[string]json.RawMessage `json:"responses"`
}

Save represents a bulk save

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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