memory

package
v0.0.0-...-4b288b9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 20

Documentation

Overview

Package memory provides an in-memory volatile config store implementation

Index

Constants

View Source
const (
	// BufferSize specifies the buffer size of event channel
	BufferSize = 100
)
View Source
const ResourceVersion string = "ResourceVersion"

Variables

This section is empty.

Functions

func Make

func Make(schemas collection.Schemas) model.ConfigStore

Make creates an in-memory config store from a config schemas It is with validation

func MakeSkipValidation

func MakeSkipValidation(schemas collection.Schemas) model.ConfigStore

MakeSkipValidation creates an in-memory config store from a config schemas It is without validation

Types

type ConfigEvent

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

ConfigEvent defines the event to be processed

type Controller

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

Controller is an implementation of ConfigStoreController.

func NewController

func NewController(cs model.ConfigStore) *Controller

NewController return an implementation of ConfigStoreController This is a client-side monitor that dispatches events as the changes are being made on the client.

func NewSyncController

func NewSyncController(cs model.ConfigStore) *Controller

NewSyncController return an implementation of model.ConfigStoreController which processes events synchronously

func (*Controller) Create

func (c *Controller) Create(config config.Config) (revision string, err error)

func (*Controller) Delete

func (c *Controller) Delete(kind config.GroupVersionKind, key, namespace string, resourceVersion *string) error

func (*Controller) Get

func (c *Controller) Get(kind config.GroupVersionKind, key, namespace string) *config.Config

func (*Controller) HasSynced

func (c *Controller) HasSynced() bool

HasSynced return whether store has synced It can be controlled externally (such as by the data source), otherwise it'll always consider synced.

func (*Controller) List

func (c *Controller) List(kind config.GroupVersionKind, namespace string) []config.Config

func (*Controller) Patch

func (c *Controller) Patch(orig config.Config, patchFn config.PatchFunc) (newRevision string, err error)

func (*Controller) RegisterEventHandler

func (c *Controller) RegisterEventHandler(kind config.GroupVersionKind, f model.EventHandler)

func (*Controller) RegisterHasSyncedHandler

func (c *Controller) RegisterHasSyncedHandler(cb func() bool)

func (*Controller) Run

func (c *Controller) Run(stop <-chan struct{})

func (*Controller) Schemas

func (c *Controller) Schemas() collection.Schemas

func (*Controller) Update

func (c *Controller) Update(config config.Config) (newRevision string, err error)

func (*Controller) UpdateStatus

func (c *Controller) UpdateStatus(config config.Config) (newRevision string, err error)

type Handler

type Handler func(config2.Config, config2.Config, model.Event)

Handler specifies a function to apply on a Config for a given event type

type Monitor

type Monitor interface {
	Run(<-chan struct{})
	AppendEventHandler(config2.GroupVersionKind, Handler)
	ScheduleProcessEvent(ConfigEvent)
}

Monitor provides methods of manipulating changes in the config store

func NewMonitor

func NewMonitor(store model.ConfigStore) Monitor

NewMonitor returns new Monitor implementation with a default event buffer size.

func NewSyncMonitor

func NewSyncMonitor(store model.ConfigStore) Monitor

NewMonitor returns new Monitor implementation which will process events synchronously

Jump to

Keyboard shortcuts

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