store

package
v1.0.0-rc.18 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 9 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 store reads and writes Beekeeper's four resources through controller-runtime's client, limited to the organizations' namespaces.

The coordinator is the only writer of task, session and runner status. It loads everything once when it is elected, with a consistent read, and then keeps its own state, writing through the store on every change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheOptions

func CacheOptions(namespaces []string) cache.Options

CacheOptions limits a cache to the organizations' namespaces.

func NewScheme

func NewScheme() (*runtime.Scheme, error)

NewScheme returns a scheme with Kubernetes' built-in types, which include SubjectAccessReview and Lease, and Beekeeper's.

Types

type Snapshot

type Snapshot struct {
	Runners       []v1alpha1.Runner
	Tasks         []v1alpha1.AgentTask
	Sessions      []v1alpha1.AgentSession
	Subscriptions []v1alpha1.Subscription
}

Snapshot is every resource in the organizations' namespaces.

type Store

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

Store reads and writes the resources of the organizations' namespaces.

func New

func New(c client.Client, reader client.Reader, namespaces []string) *Store

New returns a store that writes with c and loads with reader, which should read the API directly so a new leader sees its predecessor's last writes.

func (*Store) Create

func (s *Store) Create(ctx context.Context, obj client.Object) error

Create creates obj with its status: the API drops a new object's status, so it is written after the create. obj is updated to what was stored.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, obj client.Object) error

Delete deletes obj. An object that is already gone is no error.

func (*Store) Load

func (s *Store) Load(ctx context.Context) (Snapshot, error)

Load lists every resource in the namespaces.

func (*Store) PatchStatus

func (s *Store) PatchStatus(ctx context.Context, before, after client.Object) error

PatchStatus writes the difference between before's and after's status as a merge patch, so a status write never conflicts with a spec write. after is updated to what was stored.

func (*Store) Update

func (s *Store) Update(ctx context.Context, obj client.Object) error

Update writes obj's spec and metadata.

func (Store) WithWriteCheck

func (s Store) WithWriteCheck(check func() error) *Store

WithWriteCheck returns a store that checks leadership before each API write.

Jump to

Keyboard shortcuts

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