apiserver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAggregateWatcher

func NewAggregateWatcher(state *ShardedResourceVersions, delegates map[string]watch.Interface) watch.Interface

func NewMux

func NewMux(base storageBase) *storageMux

Types

type ShardedChunkedState

type ShardedChunkedState struct {
	// Identifier is used to locate credentials for this shard
	Identifier string `json:"id"`
	// ResourceVersion is set once we've queried the shard successfully once
	ResourceVersion int64 `json:"rv,omitempty"`
	// StartKey is set when we are chunking from this shard
	StartKey string `json:"start,omitempty"`
}

ShardedChunkedState holds state between queries for an individual shard during fan-out.

func (*ShardedChunkedState) Active

func (s *ShardedChunkedState) Active() bool

Active determines if this shard is being actively chunked

func (*ShardedChunkedState) ContinueToken

func (s *ShardedChunkedState) ContinueToken() (string, error)

ContinueToken encodes shard-specific continue tokens and resource versions for chunking

func (*ShardedChunkedState) Exhausted

func (s *ShardedChunkedState) Exhausted() bool

Exhausted determines if this shard has been fully chunked

func (*ShardedChunkedState) Pending

func (s *ShardedChunkedState) Pending() bool

Pending determines if this shard has not been chunked yet

type ShardedChunkedStates

type ShardedChunkedStates struct {
	// ShardResourceVersion is the version at which the list of shards
	// that needed to be queried was resolved.
	ShardResourceVersion int64 `json:"srv"`
	// ResourceVersions hold state for individual shards being queried.
	ResourceVersions []ShardedChunkedState `json:"rvs"`
}

ShardedChunkedStates stores values we use to keep track of what shards we're contacting for a chunked LIST request during fan-out and where we're at with those delegates. This data is either encoded in a client's continue query.

func NewChunkedState

func NewChunkedState(encodedContinueTokens string, identifiers []string, shardResourceVersion int64) (*ShardedChunkedStates, error)

NewChunkedState parses state from a user query or initializes it if the client did not request anything specific.

func (*ShardedChunkedStates) Decode

func (s *ShardedChunkedStates) Decode(encoded string) error

Decode decodes a continue token into state

func (*ShardedChunkedStates) Encode

func (s *ShardedChunkedStates) Encode() (string, error)

Encode encodes into a continue token

func (*ShardedChunkedStates) NextQuery

func (s *ShardedChunkedStates) NextQuery() (string, string, error)

NextQuery determines the shard identifier and query parameters we should use for the next query

func (*ShardedChunkedStates) ToResourceVersions

func (s *ShardedChunkedStates) ToResourceVersions() *ShardedResourceVersions

ToResourceVersions collapses the chunked state to a minimal state for versioning

func (*ShardedChunkedStates) UpdateWith

func (s *ShardedChunkedStates) UpdateWith(identifier string, resp metav1.ListInterface) error

UpdateWith updates the state from a new request from a shard

type ShardedHandler

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

func NewShardedHandler

func NewShardedHandler(clients map[string]*clientrest.Config, maxRequestBodyBytes int64, requestTimeout time.Duration) *ShardedHandler

func (*ShardedHandler) ServeHTTP

func (h *ShardedHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ShardedResourceVersion

type ShardedResourceVersion struct {
	// Identifier is used to locate credentials for this shard
	Identifier      string `json:"id"`
	ResourceVersion int64  `json:"rv"`
}

type ShardedResourceVersions

type ShardedResourceVersions struct {
	// ShardResourceVersion is the version at which the list of shards
	// that needed to be queried was resolved.
	ShardResourceVersion int64 `json:"srv"`
	// ResourceVersions hold versions for individual shards being queried.
	ResourceVersions []ShardedResourceVersion `json:"rvs"`
}

ShardedResourceVersions are what a client passes to the resourceVersion query parameter to initiate a LIST or WATCH across shards at a particular point in time.

func NewResourceVersionState

func NewResourceVersionState(encodedResourceVersion string, identifiers []string, shardResourceVersion int64) (*ShardedResourceVersions, error)

NewResourceVersionState parses state from a user query or initializes it if the client did not request anything specific.

func (*ShardedResourceVersions) Append

func (s *ShardedResourceVersions) Append(identifier string, resp metav1.Common) error

Append adds an entry in the state from a new event from a shard

func (*ShardedResourceVersions) Decode

func (s *ShardedResourceVersions) Decode(encoded string) error

Decode decodes a resource version into state

func (*ShardedResourceVersions) Encode

func (s *ShardedResourceVersions) Encode() (string, error)

Encode encodes into a resource version token

func (*ShardedResourceVersions) UpdateWith

func (s *ShardedResourceVersions) UpdateWith(identifier string, resp metav1.Common) error

UpdateWith updates the state from a new event from a shard

Jump to

Keyboard shortcuts

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