libevents

package
v1.0.0-rc.17 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	FiringStatusRunning = "running"
	FiringStatusOK      = "ok"
	FiringStatusError   = "error"
	FiringStatusRefused = "refused"
)
View Source
const (
	DefaultFiringLimit = 50
	MaxFiringLimit     = 1000
)
View Source
const (
	ListenerKindStart = "start"

	ListenerKindWake = "wake"
)
View Source
const (
	DefaultListenerLimit = 50
	MaxListenerLimit     = 1000
)
View Source
const (
	DefaultStagingLimit = 100
	MaxStagingLimit     = 1000
)

Variables

This section is empty.

Functions

func InitSchema

func InitSchema(ctx context.Context, exec libdb.Exec, cfg Config) error

Types

type Config

type Config struct {
	TablePrefix string

	ScopeColumn string
}

func (Config) Validate

func (c Config) Validate() error

type CursorStore

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

func NewCursorStore

func NewCursorStore(cfg Config, scope string) (*CursorStore, error)

func (*CursorStore) GetCursor

func (s *CursorStore) GetCursor(ctx context.Context, exec libdb.Exec, consumer string) (int64, error)

func (*CursorStore) SetCursor

func (s *CursorStore) SetCursor(ctx context.Context, exec libdb.Exec, consumer string, nid int64) error

type Firing

type Firing struct {
	Scope       string
	TriggerName string
	NID         int64
	Status      string
	Error       string
	RequestID   string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (Firing) Stranded

func (f Firing) Stranded(now time.Time, staleClaim time.Duration) bool

type FiringFilter

type FiringFilter struct {
	BeforeNID    int64
	AfterTrigger string
	ExactNID     int64
	Waiting      bool
	SinceNID     int64

	Status string

	TriggerName string

	Limit int
}

type FiringStore

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

func NewFiringStore

func NewFiringStore(cfg Config, scope string, staleClaim time.Duration, opts ...FiringStoreOption) (*FiringStore, error)

func (*FiringStore) BeginFiring

func (s *FiringStore) BeginFiring(ctx context.Context, exec libdb.Exec, triggerName string, nid int64, requestID string) (bool, error)

func (*FiringStore) BeginFiringOnce

func (s *FiringStore) BeginFiringOnce(ctx context.Context, exec libdb.Exec, triggerName string, nid int64, requestID string) (bool, error)

func (*FiringStore) FinishFiring

func (s *FiringStore) FinishFiring(ctx context.Context, exec libdb.Exec, triggerName string, nid int64, status, errMsg string) error

func (*FiringStore) ListFirings

func (s *FiringStore) ListFirings(ctx context.Context, exec libdb.Exec, f FiringFilter) ([]Firing, error)

func (*FiringStore) ResetFiring

func (s *FiringStore) ResetFiring(ctx context.Context, exec libdb.Exec, triggerName string, nid int64) (bool, error)

func (*FiringStore) StaleClaim

func (s *FiringStore) StaleClaim() time.Duration

type FiringStoreOption

type FiringStoreOption func(*FiringStore)

func WithClock

func WithClock(now func() time.Time) FiringStoreOption

type Listener

type Listener struct {
	ID    string
	Scope string

	Kind string

	Target string

	Owner string

	OneShot bool

	Types []string

	ContextFilters map[string]map[string]string

	Metadata  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type ListenerStore

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

func NewListenerStore

func NewListenerStore(cfg Config, scope string) (*ListenerStore, error)

func (*ListenerStore) AppendListener

func (s *ListenerStore) AppendListener(ctx context.Context, exec libdb.Exec, l *Listener) error

func (*ListenerStore) DeleteListener

func (s *ListenerStore) DeleteListener(ctx context.Context, exec libdb.Exec, id string) error

func (*ListenerStore) DeleteListenersByOwner

func (s *ListenerStore) DeleteListenersByOwner(ctx context.Context, exec libdb.Exec, owner string) ([]string, error)

func (*ListenerStore) GetListener

func (s *ListenerStore) GetListener(ctx context.Context, exec libdb.Exec, id string) (*Listener, error)

func (*ListenerStore) ListListeners

func (s *ListenerStore) ListListeners(ctx context.Context, exec libdb.Exec, afterCreatedAt time.Time, afterID string, limit int) ([]*Listener, error)

func (*ListenerStore) ListListenersByType

func (s *ListenerStore) ListListenersByType(ctx context.Context, exec libdb.Exec, eventType string) ([]*Listener, error)

type StagedEvent

type StagedEvent struct {
	ID           string
	Scope        string
	Payload      []byte
	DelayedUntil time.Time
	CreatedAt    time.Time
}

type StagingStore

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

func NewStagingStore

func NewStagingStore(cfg Config, scope string) (*StagingStore, error)

func (*StagingStore) AppendStagedEvent

func (s *StagingStore) AppendStagedEvent(ctx context.Context, exec libdb.Exec, e *StagedEvent) error

func (*StagingStore) DeleteStagedEvents

func (s *StagingStore) DeleteStagedEvents(ctx context.Context, exec libdb.Exec, ids ...string) error

func (*StagingStore) ListDueStagedEvents

func (s *StagingStore) ListDueStagedEvents(ctx context.Context, exec libdb.Exec, now time.Time, limit int) ([]*StagedEvent, error)

Jump to

Keyboard shortcuts

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