cards

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 14 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 cards keeps the units' card snapshots and derived items current with the rows the read model publishes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Served

func Served(s card.Store, enabled func(unit.ProviderID) bool) card.Store

Served is s with each snapshot of a disabled plugin marked Stale; s itself when enabled is nil.

Types

type Job

type Job struct {
	Store     card.Store
	Ledger    coreitems.Reconciler
	Open      OpenItems
	Providers map[unit.ProviderID]Provider
	Clock     port.Clock
	Log       func(string, ...any)
	// contains filtered or unexported fields
}

Job stores each changed row's card when it differs and reconciles its derived items. Changed never blocks: units queue, and a unit changed again before its turn is read once, at its newest row. A unit with no row resolves its open derived items; Open, when set, lets a full sweep find the units that left while the daemon was down.

func (*Job) Changed

func (j *Job) Changed(c api.Change)

Changed queues the units of a published row change; an All change queues every row.

func (*Job) Run

func (j *Job) Run(ctx context.Context, rows Rows)

Run sweeps every row once, then each queued change, until ctx ends.

type OpenItems

type OpenItems interface {
	Query(ctx context.Context, q coreitems.Query) ([]items.Item, error)
}

OpenItems finds the open items of units that may have no row.

type Provider

type Provider struct {
	Card  func(ctx context.Context, row api.Row) (card.Card, error)
	Items func(row api.Row) []items.Item
}

Provider is what one enabled plugin derives from its rows; a nil field is a capability the plugin lacks.

type Rows

type Rows interface {
	Row(ctx context.Context, u unit.Unit, asked catalog.Asked) (api.Row, bool, error)
	Rows(ctx context.Context, view string, since api.Since) (api.RowsPage, error)
}

Rows is the read model as the job reads it.

Jump to

Keyboard shortcuts

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