package stream

import "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3"

Index

Types

type DeltaStream

type DeltaStream interface {
	grpc.ServerStream

	Send(*discovery.DeltaDiscoveryResponse) error
	Recv() (*discovery.DeltaDiscoveryRequest, error)
}

Generic RPC Stream for the delta based xDS protocol.

type Stream

type Stream interface {
	grpc.ServerStream

	Send(*discovery.DiscoveryResponse) error
	Recv() (*discovery.DiscoveryRequest, error)
}

Generic RPC stream for state of the world.

type StreamState

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

StreamState will keep track of resource cache state per type on a stream.

func NewStreamState

func NewStreamState(wildcard bool, initialResourceVersions map[string]string) StreamState

NewStreamState initializes a stream state.

func (*StreamState) GetKnownResourceNames

func (s *StreamState) GetKnownResourceNames(url string) map[string]struct{}

GetKnownResourceNames returns the current known list of resources on a SOTW stream.

func (*StreamState) GetResourceVersions

func (s *StreamState) GetResourceVersions() map[string]string

GetResourceVersions returns a map of current resources grouped by type URL.

func (*StreamState) GetSubscribedResourceNames

func (s *StreamState) GetSubscribedResourceNames() map[string]struct{}

GetSubscribedResourceNames returns the list of resources currently explicitly subscribed to If the request is set to wildcard it may be empty Currently populated only when using delta-xds

func (*StreamState) IsFirst

func (s *StreamState) IsFirst() bool

IsFirst returns whether or not the state of the stream is based upon the initial request.

func (*StreamState) IsWildcard

func (s *StreamState) IsWildcard() bool

IsWildcard returns whether or not an xDS client requested in wildcard mode on the initial request.

func (*StreamState) SetKnownResourceNames

func (s *StreamState) SetKnownResourceNames(url string, names map[string]struct{})

SetKnownResourceNames sets a list of resource names in a stream utilizing the SOTW protocol.

func (*StreamState) SetKnownResourceNamesAsList

func (s *StreamState) SetKnownResourceNamesAsList(url string, names []string)

SetKnownResourceNamesAsList is a helper function to set resource names as a slice input.

func (*StreamState) SetResourceVersions

func (s *StreamState) SetResourceVersions(resourceVersions map[string]string)

SetResourceVersions sets a list of resource versions by type URL and removes the flag of "first" since we can safely assume another request has come through the stream.

func (*StreamState) SetSubscribedResourceNames

func (s *StreamState) SetSubscribedResourceNames(subscribedResourceNames map[string]struct{})

SetSubscribedResourceNames is setting the list of resources currently explicitly subscribed to It is decorrelated from the wildcard state of the stream Currently used only when using delta-xds

func (*StreamState) SetWildcard

func (s *StreamState) SetWildcard(wildcard bool)

func (*StreamState) WatchesResources

func (s *StreamState) WatchesResources(resourceNames map[string]struct{}) bool

WatchesResources returns whether at least one of the resource provided is currently watch by the stream It is currently only applicable to delta-xds If the request is wildcard, it will always return true Otherwise it will compare the provided resources to the list of resources currently subscribed

Source Files

stream.go

Version
v0.13.4 (latest)
Published
Jan 6, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
1 hour ago

Tools for package owners.