storage

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConditionKeyStore

func NewConditionKeyStore(js nats.JetStreamContext) nats.KeyValue

func NewEndpointKeyStore

func NewEndpointKeyStore(js nats.JetStreamContext) nats.KeyValue

func NewIncidentKeyStore

func NewIncidentKeyStore(js nats.JetStreamContext) nats.KeyValue

func NewRouterObjectStore

func NewRouterObjectStore(js nats.JetStreamContext) nats.ObjectStore

func NewStatusCache

func NewStatusCache(js nats.JetStreamContext) nats.KeyValue

Types

type AlertingClientSet

type AlertingClientSet interface {
	HashRing
	Purge(ctx context.Context) error
	Conditions() ConditionStorage
	Endpoints() EndpointStorage
	Routers() RouterStorage
	States() StateStorage
	Incidents() IncidentStorage
}

type AlertingIncidentTracker

type AlertingIncidentTracker[T interfaces.AlertingSecret] interface {
	AlertingStorage[T]
	OpenInterval(ctx context.Context, conditionId, fingerprint string, start *timestamppb.Timestamp) error
	CloseInterval(ctx context.Context, conditionId, fingerprint string, end *timestamppb.Timestamp) error
	GetActiveWindowsFromIncidentTracker(
		ctx context.Context,
		conditionId string,
		start,
		end *timestamppb.Timestamp,
	) ([]*alertingv1.ActiveWindow, error)
}

type AlertingSecretStorage

type AlertingSecretStorage[T interfaces.AlertingSecret] interface {
	AlertingStorage[T]
}

type AlertingStateCache

type AlertingStateCache[T interfaces.AlertingSecret] interface {
	AlertingStorage[T]
	IsDiff(ctx context.Context, key string, value T) bool
	LastKnownChange(ctx context.Context, key string) (*timestamppb.Timestamp, error)
}

type AlertingStorage

type AlertingStorage[T any] interface {
	Put(ctx context.Context, key string, value T) error
	Get(ctx context.Context, key string, opts ...opts.RequestOption) (T, error)
	Delete(ctx context.Context, key string) error
	ListKeys(ctx context.Context) ([]string, error)
	List(ctx context.Context, opts ...opts.RequestOption) ([]T, error)
}

type AlertingStoreBroker

type AlertingStoreBroker interface {
	NewClientSet() AlertingClientSet
	// Use applies a specific storage client to the matching storage client in the clientset
	//
	// It is also responsible for migrating existing data if there is an existing store
	// of the same type already in use by the clientset
	Use(store any)
}

type CompositeAlertingBroker

type CompositeAlertingBroker struct {
	opts.ClientSetOptions
	*CompositeAlertingClientSet
}

func NewCompositeAlertingBroker

func NewCompositeAlertingBroker(options opts.ClientSetOptions) *CompositeAlertingBroker

func (*CompositeAlertingBroker) NewClientSet

func (c *CompositeAlertingBroker) NewClientSet() AlertingClientSet

func (*CompositeAlertingBroker) Use

func (c *CompositeAlertingBroker) Use(store any)

type CompositeAlertingClientSet

type CompositeAlertingClientSet struct {
	Logger *zap.SugaredLogger
	// contains filtered or unexported fields
}

func (*CompositeAlertingClientSet) CalculateHash

func (c *CompositeAlertingClientSet) CalculateHash(ctx context.Context, key string, syncOptions *storage_opts.SyncOptions) error

func (CompositeAlertingClientSet) Conditions

func (CompositeAlertingClientSet) Endpoints

func (*CompositeAlertingClientSet) ForceSync

func (c *CompositeAlertingClientSet) ForceSync(ctx context.Context, incomingOpts ...storage_opts.SyncOption) error

Based on the other storage, calculate what the virtual config should be, then overwrite the virtual config storage

func (*CompositeAlertingClientSet) GetHash

func (CompositeAlertingClientSet) Incidents

func (*CompositeAlertingClientSet) Purge

func (CompositeAlertingClientSet) Routers

func (CompositeAlertingClientSet) States

func (*CompositeAlertingClientSet) Sync

func (c *CompositeAlertingClientSet) Sync(ctx context.Context, incomingOpts ...storage_opts.SyncOption) ([]string, error)

type HashRing

type HashRing interface {
	CalculateHash(ctx context.Context, key string, syncOptions *opts.SyncOptions) error
	GetHash(ctx context.Context, key string) string
	// Sync reads from the client set and updates the router storage in the appropriate way
	// It returns the router keys that have changed.
	Sync(ctx context.Context, opts ...opts.SyncOption) (routerKeys []string, err error)
	ForceSync(ctx context.Context, opts ...opts.SyncOption) error
}

HashRing Hash ring uniquely maps groups of objects to a (key, hash) pairs

type RouterStorage

type RouterStorage = AlertingStorage[routing.OpniRouting]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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