Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
func Bind(ctx context.Context, callback func([]protoreflect.Value), reactiveValues ...Value)
Bind groups multiple reactive.Value instances together, de-duplicating updates using the revision of the underlying config.
The callback is invoked when one or more reactive.Values change, and is passed the current or updated value of each reactive value, in the order they were passed to Bind. Values that have never been set will be invalid (protoreflect.Value.IsValid() returns false).
For partial updates, the values passed to the callback will be either the updated value or the current value, depending on whether the value was updated in the current revision.
The callback is guaranteed to be invoked exactly once for a single change to the active config, even if multiple values in the group change at the same time. The values must all be created from the same controller, otherwise the behavior is undefined.
Types ¶
type Controller ¶
type Controller[T server.ConfigType[T]] struct { ControllerOptions // contains filtered or unexported fields }
func NewController ¶
func NewController[T server.ConfigType[T]](tracker *server.DefaultingConfigTracker[T], opts ...ControllerOption) *Controller[T]
type ControllerOption ¶
type ControllerOption func(*ControllerOptions)
func WithDiffMode ¶
func WithDiffMode(mode DiffMode) ControllerOption
func WithLogger ¶
func WithLogger(eventLogger *slog.Logger) ControllerOption
type ControllerOptions ¶
type ControllerOptions struct {
// contains filtered or unexported fields
}
type ControllerServer ¶
type ControllerServer[S WatchReactiveServerStream, T server.ConfigType[T]] struct { *Controller[T] }
func (*ControllerServer[S, T]) Build ¶
func (c *ControllerServer[S, T]) Build(ctrl *Controller[T])
func (*ControllerServer[S, T]) WatchReactive ¶
func (s *ControllerServer[S, T]) WatchReactive(in *corev1.ReactiveWatchRequest, stream S) error
type Encoder ¶
type Encoder[T any] interface { FromValue(protoreflect.Value) T }
type Reactive ¶
type Value ¶
type Value Reactive[protoreflect.Value]
type WatchReactiveServerStream ¶
type WatchReactiveServerStream interface { Send(*corev1.ReactiveEvents) error grpc.ServerStream }
Directories
¶
Path | Synopsis |
---|---|
Functions in this package are useful in a few specific cases, but require careful consideration to ensure they are used correctly.
|
Functions in this package are useful in a few specific cases, but require careful consideration to ensure they are used correctly. |