sink

package
v0.170.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 11 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

Overview

Package sink dispatches a configured GitHub workflow on selected events (config.Sink): workflow_dispatch with the inputs verb, subject and time, nothing else. Every watch on the machine offers the events it follows; sink.json in the state directory claims each one once, so two watches never dispatch the same event twice.

Index

Constants

View Source
const Window = 10 * time.Minute

Window is how old an event may be and still be dispatched: one a watch did not reach within it (the machine was down, no watch ran) is let go, and a failed dispatch is retried within it.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(ctx context.Context, gh github.GH, s config.Sink, e state.Event) error

Dispatch runs the sink's workflow for e through gh: workflow_dispatch on s.Ref (the repository's default branch when unset) with the inputs verb, subject and time.

func Key

func Key(e state.Event) string

Key names an event across the watches that read it.

Types

type Ledger

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

Ledger keeps sink.json in beekeeper's state directory, changed only under sink.lock.

func NewLedger

func NewLedger(dir string) *Ledger

NewLedger returns the ledger kept in dir.

func (*Ledger) Claim

func (l *Ledger) Claim(ctx context.Context, now time.Time, evs []state.Event) ([]state.Event, error)

Claim returns the events of evs this caller dispatches: not claimed yet, within Window of now and not before the ledger's start, and claims them. The first call starts the ledger and claims nothing.

func (*Ledger) Path

func (l *Ledger) Path() string

Path is the ledger file.

func (*Ledger) Unclaim

func (l *Ledger) Unclaim(ctx context.Context, now time.Time, e state.Event) error

Unclaim gives e back after its dispatch failed: the next watch to offer it within Window tries again.

Jump to

Keyboard shortcuts

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