Documentation ¶
Overview ¶
Package fake implements the reflector interfaces for testing purposes.
Index ¶
- type FallbackReflector
- type NamespacedReflector
- type Reflector
- func (r *Reflector) IsLeaderRestricted() bool
- func (r *Reflector) Resync() error
- func (r *Reflector) Start(_ context.Context, opts *options.ReflectorOpts)
- func (r *Reflector) StartNamespace(opts *options.NamespacedOpts)
- func (r *Reflector) StopNamespace(local, remote string)
- func (r *Reflector) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FallbackReflector ¶ added in v0.3.2
type FallbackReflector struct { Opts options.ReflectorOpts Handled int // contains filtered or unexported fields }
FallbackReflector implements a fake FallbackReflector for testing purposes.
func NewFallbackReflector ¶ added in v0.3.2
func NewFallbackReflector(opts *options.ReflectorOpts) *FallbackReflector
NewFallbackReflector returns a new fake FallbackReflector.
func (*FallbackReflector) Handle ¶ added in v0.3.2
func (r *FallbackReflector) Handle(_ context.Context, _ types.NamespacedName) error
Handle increments the Handled counter.
func (*FallbackReflector) Keys ¶ added in v0.3.2
func (r *FallbackReflector) Keys(local, remote string) []types.NamespacedName
Keys returns a key with the namespace equal to the local namespace and the name equal to the remote one.
func (*FallbackReflector) List ¶ added in v0.9.0
func (r *FallbackReflector) List() ([]interface{}, error)
List returns an empty list.
func (*FallbackReflector) Ready ¶ added in v0.3.2
func (r *FallbackReflector) Ready() bool
Ready returns whether the NamespacedReflector is completely initialized.
func (*FallbackReflector) SetReady ¶ added in v0.3.2
func (r *FallbackReflector) SetReady()
SetReady marks the NamespacedReflector as completely initialized.
type NamespacedReflector ¶
type NamespacedReflector struct { Opts options.NamespacedOpts Handled int // contains filtered or unexported fields }
NamespacedReflector implements a fake NamespacedReflector for testing purposes.
func NewNamespacedReflector ¶
func NewNamespacedReflector(opts *options.NamespacedOpts) *NamespacedReflector
NewNamespacedReflector returns a new fake NamespacedReflector.
func (*NamespacedReflector) Handle ¶
func (r *NamespacedReflector) Handle(_ context.Context, _ string) error
Handle increments the Handled counter.
func (*NamespacedReflector) List ¶ added in v0.9.0
func (r *NamespacedReflector) List() ([]interface{}, error)
List returns the list of handled namespaces.
func (*NamespacedReflector) Ready ¶
func (r *NamespacedReflector) Ready() bool
Ready returns whether the NamespacedReflector is completely initialized.
func (*NamespacedReflector) SetReady ¶
func (r *NamespacedReflector) SetReady()
SetReady marks the NamespacedReflector as completely initialized.
type Reflector ¶
type Reflector struct { Started bool Opts *options.ReflectorOpts NamespaceStarted map[string]*options.NamespacedOpts NamespaceStopped map[string]string NamespaceReady map[string]func() bool // contains filtered or unexported fields }
Reflector implements a fake Reflector for testing purposes.
func NewReflector ¶
NewReflector returns a new fake Reflector.
func (*Reflector) IsLeaderRestricted ¶ added in v0.9.0
IsLeaderRestricted returns whether the reflector is restricted to the leader.
func (*Reflector) Start ¶
func (r *Reflector) Start(_ context.Context, opts *options.ReflectorOpts)
Start marks the reflector as started.
func (*Reflector) StartNamespace ¶
func (r *Reflector) StartNamespace(opts *options.NamespacedOpts)
StartNamespace marks the given namespace as started, and stores the given options.
func (*Reflector) StopNamespace ¶
StopNamespace marks the given namespace as stopped, and stores the remote namespace name.