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 ¶
- func CacheOptions(namespaces []string) cache.Options
- func NewScheme() (*runtime.Scheme, error)
- type Snapshot
- type Store
- func (s *Store) Create(ctx context.Context, obj client.Object) error
- func (s *Store) Delete(ctx context.Context, obj client.Object) error
- func (s *Store) Load(ctx context.Context) (Snapshot, error)
- func (s *Store) PatchStatus(ctx context.Context, before, after client.Object) error
- func (s *Store) Update(ctx context.Context, obj client.Object) error
- func (s Store) WithWriteCheck(check func() error) *Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheOptions ¶
CacheOptions limits a cache to the organizations' namespaces.
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 ¶
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 ¶
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) PatchStatus ¶
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) WithWriteCheck ¶
WithWriteCheck returns a store that checks leadership before each API write.