target

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLookup = errors.New("target lookup error")

Functions

func NewTransactionError added in v0.0.47

func NewTransactionError(err error, recoverable bool) error

NewTransactionError creates a new TransactionError

Types

type Collector added in v0.0.44

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

func NewCollector added in v0.0.44

func NewCollector(targetKey storebackend.Key, subscriptions *Subscriptions) *Collector

func (*Collector) GetUpdateChan added in v0.0.44

func (r *Collector) GetUpdateChan() chan struct{}

func (*Collector) IsRunning added in v0.0.44

func (r *Collector) IsRunning() bool

func (*Collector) SetPort added in v0.0.44

func (r *Collector) SetPort(port uint)

func (*Collector) Start added in v0.0.44

func (*Collector) StartSubscription added in v0.0.44

func (r *Collector) StartSubscription(ctx context.Context)

func (*Collector) Stop added in v0.0.44

func (r *Collector) Stop(ctx context.Context)

func (*Collector) StopSubscription added in v0.0.44

func (r *Collector) StopSubscription(ctx context.Context)

type Context

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

func New

func New(targetKey storebackend.Key, client client.Client, dsclient dsclient.Client) *Context

func (*Context) Cancel added in v0.0.47

func (r *Context) Cancel(ctx context.Context, key storebackend.Key, transactionID string) error

func (*Context) Confirm added in v0.0.47

func (r *Context) Confirm(ctx context.Context, key storebackend.Key, transactionID string) error

func (*Context) CreateDS

func (r *Context) CreateDS(ctx context.Context, datastoreReq *sdcpb.CreateDataStoreRequest) error

func (*Context) DeleteDS

func (r *Context) DeleteDS(ctx context.Context) error

func (*Context) DeleteIntent

func (r *Context) DeleteIntent(ctx context.Context, key storebackend.Key, config *config.Config, dryRun bool) (string, error)

func (*Context) DeleteSubscription added in v0.0.44

func (r *Context) DeleteSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error

func (*Context) GetAddress

func (r *Context) GetAddress() string

func (*Context) GetBlameConfig added in v0.0.52

func (r *Context) GetBlameConfig(ctx context.Context, key storebackend.Key) (*config.ConfigBlame, error)

func (*Context) GetCache added in v0.0.44

func (r *Context) GetCache() cache.Cache

func (*Context) GetDSClient added in v0.0.50

func (r *Context) GetDSClient() dsclient.Client

func (*Context) GetData

func (r *Context) GetData(ctx context.Context, key storebackend.Key) (*config.RunningConfig, error)

func (*Context) GetDataStore

func (*Context) GetPrombLabels added in v0.0.44

func (r *Context) GetPrombLabels() []prompb.Label

func (*Context) GetSchema

func (*Context) IsConfigRecovered added in v0.0.50

func (r *Context) IsConfigRecovered(ctx context.Context) bool

func (*Context) IsReady

func (r *Context) IsReady() bool

func (*Context) RecoverIntents added in v0.0.47

func (r *Context) RecoverIntents(ctx context.Context, key storebackend.Key, configs []*config.Config) (string, error)

func (*Context) SetIntent

func (r *Context) SetIntent(ctx context.Context, key storebackend.Key, config *config.Config, dryRun bool) (string, error)

func (*Context) SetIntents added in v0.0.47

func (r *Context) SetIntents(ctx context.Context, key storebackend.Key, transactionID string, configs, deleteConfigs []*config.Config, dryRun bool) (string, error)

func (*Context) SetNotReady added in v0.0.43

func (r *Context) SetNotReady(ctx context.Context)

func (*Context) SetReady

func (r *Context) SetReady(ctx context.Context)

func (*Context) SetRecoveredConfigs added in v0.0.50

func (r *Context) SetRecoveredConfigs(ctx context.Context)

func (*Context) TransactionSet added in v0.0.47

func (r *Context) TransactionSet(ctx context.Context, req *sdcpb.TransactionSetRequest) (string, error)

func (*Context) UpsertSubscription added in v0.0.44

func (r *Context) UpsertSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error

type DeviationWatcher

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

func NewDeviationWatcher

func NewDeviationWatcher(targetKey storebackend.Key, client client.Client, dsclient dsclient.Client) *DeviationWatcher

func (*DeviationWatcher) Start

func (r *DeviationWatcher) Start(ctx context.Context)

func (*DeviationWatcher) Stop

func (r *DeviationWatcher) Stop(ctx context.Context)

type LookupError added in v0.0.28

type LookupError struct {
	Message      string
	WrappedError error
}
var TargetLookupErr *LookupError

func (*LookupError) Error added in v0.0.50

func (e *LookupError) Error() string

func (*LookupError) Unwrap added in v0.0.50

func (e *LookupError) Unwrap() error

type MockContext added in v0.0.47

type MockContext struct {
	Ready              bool
	Busy               *time.Duration
	Message            string
	SetIntentError     error
	DeleteIntentError  error
	RecoverIntentError error
	CancelError        error
	ConfirmError       error
}

type Path added in v0.0.44

type Path struct {
	Path     string
	Interval int
}

type PathSubscriptions added in v0.0.44

type PathSubscriptions struct {
	Current *Subscription
	// AllSubscriptions list all the subscriptions that are in the system, the key is name of the subscription CR
	AllSubscriptions map[string]*Subscription
}

type Subscription added in v0.0.44

type Subscription struct {
	NSN         string // namespacedname of the CR that originated this subscription
	Name        string // name of the subscription
	Description *string
	Labels      map[string]string
	Enabled     bool
	Interval    int // 0 = onChange
	Encoding    invv1alpha1.Encoding
}

type Subscriptions added in v0.0.44

type Subscriptions struct {
	Paths store.Storer[*PathSubscriptions]
}

func NewSubscriptions added in v0.0.44

func NewSubscriptions() *Subscriptions

func (*Subscriptions) AddSubscription added in v0.0.44

func (r *Subscriptions) AddSubscription(subscription *invv1alpha1.Subscription) error

Add or update a subscription

func (*Subscriptions) DelSubscription added in v0.0.44

func (r *Subscriptions) DelSubscription(subscription *invv1alpha1.Subscription) error

func (*Subscriptions) GetPaths added in v0.0.44

func (r *Subscriptions) GetPaths() map[invv1alpha1.Encoding][]Path

func (*Subscriptions) HasSubscriptions added in v0.0.44

func (r *Subscriptions) HasSubscriptions() bool

type TargetHandler added in v0.0.27

type TargetHandler interface {
	GetTargetContext(ctx context.Context, targetKey types.NamespacedName) (*invv1alpha1.Target, *Context, error)
	SetIntent(ctx context.Context, targetKey types.NamespacedName, config *config.Config, dryRun bool) (*config.ConfigStatusLastKnownGoodSchema, string, error)
	DeleteIntent(ctx context.Context, targetKey types.NamespacedName, config *config.Config, dryRun bool) (string, error)
	GetData(ctx context.Context, targetKey types.NamespacedName) (*config.RunningConfig, error)
	RecoverIntents(ctx context.Context, targetKey types.NamespacedName, configs []*config.Config) (*config.ConfigStatusLastKnownGoodSchema, string, error)
	SetIntents(ctx context.Context, targetKey types.NamespacedName, transactionID string, configs, deleteConfigs []*config.Config, dryRun bool) (*config.ConfigStatusLastKnownGoodSchema, string, error)
	Confirm(ctx context.Context, targetKey types.NamespacedName, transactionID string) error
	Cancel(ctx context.Context, targetKey types.NamespacedName, transactionID string) error
	GetBlameConfig(ctx context.Context, targetKey types.NamespacedName) (*config.ConfigBlame, error)
}

func NewMockTargetHandler added in v0.0.47

func NewMockTargetHandler(targetStore storebackend.Storer[*MockContext]) TargetHandler

func NewTargetHandler added in v0.0.27

func NewTargetHandler(client client.Client, targetStore storebackend.Storer[*Context]) TargetHandler

type TransactionError added in v0.0.47

type TransactionError struct {
	Recoverable bool
	Err         error
}

TransactionError represents an error with recoverability classification

func (*TransactionError) Error added in v0.0.47

func (e *TransactionError) Error() string

Jump to

Keyboard shortcuts

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