subscribe

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 13 Imported by: 5 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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