subscribe

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultGetter

func DefaultGetter(apiOp *types.APIRequest) *types.APISchemas

func Handler

func Handler(apiOp *types.APIRequest, getter SchemasGetter, serverVersion string) (types.APIObjectList, error)

func MarshallObject

func MarshallObject(apiOp *types.APIRequest, getter SchemasGetter, event types.APIEvent) types.APIEvent

func NewHandler

func NewHandler(getter SchemasGetter, serverVersion string) types.RequestListHandler

func Register

func Register(schemas *types.APISchemas, getter SchemasGetter, serverVersion string)

Types

type Converter

type Converter struct {
	writer.EncodingResponseWriter
	// contains filtered or unexported fields
}

func (*Converter) Encoder

func (c *Converter) Encoder(_ io.Writer, obj interface{}) error

func (*Converter) ToAPIObject

func (c *Converter) ToAPIObject(data types.APIObject) (interface{}, error)

type DebouncerState added in v0.6.1

type DebouncerState int
const (
	// The first notification is always sent right away, no need to wait
	FirstNotification DebouncerState = iota
	TimerStarted
	TimerStopped
)

type SchemasGetter

type SchemasGetter func(apiOp *types.APIRequest) *types.APISchemas

type Subscribe

type Subscribe struct {
	Mode            SubscriptionMode `json:"mode,omitempty"`
	Stop            bool             `json:"stop,omitempty"`
	ResourceType    string           `json:"resourceType,omitempty"`
	ResourceVersion string           `json:"resourceVersion,omitempty"`
	Namespace       string           `json:"namespace,omitempty"`
	ID              string           `json:"id,omitempty"`
	Selector        string           `json:"selector,omitempty"`
	// DebounceMs will debounce events when Mode is SubscriptionModeNotification. Unused for other Mode values.
	DebounceMs int `json:"debounceMs,omitempty"`
}

type SubscriptionMode added in v0.6.1

type SubscriptionMode string
const (
	// SubscriptionModeDefault tells the subscription to return the events
	// as they come in with the object embedded inside
	SubscriptionModeDefault SubscriptionMode = ""
	// SubscriptionModeNotification tells the subscription to return a notification event
	// whenever an event comes in. The consumer is expected to then make another list request
	// to get the latest data.
	SubscriptionModeNotification SubscriptionMode = "resource.changes"
)

type WatchSession

type WatchSession struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewWatchSession

func NewWatchSession(apiOp *types.APIRequest, getter SchemasGetter) *WatchSession

func (*WatchSession) Close

func (s *WatchSession) Close()

func (*WatchSession) Watch

func (s *WatchSession) Watch(conn *websocket.Conn) <-chan types.APIEvent

Jump to

Keyboard shortcuts

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