partition

package
v2.0.0-...-1d53c46 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package partition implements a store with parallel partitioning of data so that segmented data can be concurrently collected and returned as a single data set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParallelPartitionLister

type ParallelPartitionLister struct {
	// Lister is the lister method for a single partition.
	Lister PartitionLister

	// Concurrency is the weight of the semaphore.
	Concurrency int64

	// Partitions is the set of partitions that will be concurrently queried.
	Partitions []Partition
	// contains filtered or unexported fields
}

ParallelPartitionLister defines how a set of partitions will be queried.

func (*ParallelPartitionLister) Continue

func (p *ParallelPartitionLister) Continue() string

Continue returns the encoded continue token based on the current list state.

func (*ParallelPartitionLister) Err

func (p *ParallelPartitionLister) Err() error

Err returns the latest error encountered.

func (*ParallelPartitionLister) List

func (p *ParallelPartitionLister) List(ctx context.Context, limit int, resume, revision string) (<-chan []unstructured.Unstructured, error)

List returns a stream of objects up to the requested limit. If the continue token is not empty, it decodes it and returns the stream starting at the indicated marker.

func (*ParallelPartitionLister) Revision

func (p *ParallelPartitionLister) Revision() string

Revision returns the revision for the current list state.

type Partition

type Partition interface {
	Name() string
}

Partition represents a named grouping of kubernetes resources, such as by namespace or a set of names.

type PartitionLister

type PartitionLister func(ctx context.Context, partition Partition, cont string, revision string, limit int) (*unstructured.UnstructuredList, []types.Warning, error)

PartitionLister lists objects for one partition.

type Partitioner

type Partitioner interface {
	Lookup(apiOp *types.APIRequest, schema *types.APISchema, verb, id string) (Partition, error)
	All(apiOp *types.APIRequest, schema *types.APISchema, verb, id string) ([]Partition, error)
	Store(apiOp *types.APIRequest, partition Partition) (UnstructuredStore, error)
}

Partitioner is an interface for interacting with partitions.

type Store

type Store struct {
	Partitioner Partitioner
	// contains filtered or unexported fields
}

Store implements types.Store for partitions.

func NewStore

func NewStore(partitioner Partitioner, asl accesscontrol.AccessSetLookup, namespaceCache corecontrollers.NamespaceCache) *Store

NewStore creates a types.Store implementation with a partitioner and an LRU expiring cache for list responses.

func (*Store) ByID

func (s *Store) ByID(apiOp *types.APIRequest, schema *types.APISchema, id string) (types.APIObject, error)

ByID looks up a single object by its ID.

func (*Store) Create

func (s *Store) Create(apiOp *types.APIRequest, schema *types.APISchema, data types.APIObject) (types.APIObject, error)

Create creates a single object in the store.

func (*Store) Delete

func (s *Store) Delete(apiOp *types.APIRequest, schema *types.APISchema, id string) (types.APIObject, error)

Delete deletes an object from a store.

func (*Store) List

func (s *Store) List(apiOp *types.APIRequest, schema *types.APISchema) (types.APIObjectList, error)

List returns a list of objects across all applicable partitions. If pagination parameters are used, it returns a segment of the list.

func (*Store) Update

func (s *Store) Update(apiOp *types.APIRequest, schema *types.APISchema, data types.APIObject, id string) (types.APIObject, error)

Update updates a single object in the store.

func (*Store) Watch

func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, wr types.WatchRequest) (chan types.APIEvent, error)

Watch returns a channel of events for a list or resource.

type UnstructuredStore

type UnstructuredStore interface {
	ByID(apiOp *types.APIRequest, schema *types.APISchema, id string) (*unstructured.Unstructured, []types.Warning, error)
	List(apiOp *types.APIRequest, schema *types.APISchema) (*unstructured.UnstructuredList, []types.Warning, error)
	Create(apiOp *types.APIRequest, schema *types.APISchema, data types.APIObject) (*unstructured.Unstructured, []types.Warning, error)
	Update(apiOp *types.APIRequest, schema *types.APISchema, data types.APIObject, id string) (*unstructured.Unstructured, []types.Warning, error)
	Delete(apiOp *types.APIRequest, schema *types.APISchema, id string) (*unstructured.Unstructured, []types.Warning, error)
	Watch(apiOp *types.APIRequest, schema *types.APISchema, w types.WatchRequest) (chan watch.Event, error)
}

UnstructuredStore is like types.Store but deals in k8s unstructured objects instead of apiserver types.

Directories

Path Synopsis
Package listprocessor contains methods for filtering, sorting, and paginating lists of objects.
Package listprocessor contains methods for filtering, sorting, and paginating lists of objects.

Jump to

Keyboard shortcuts

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