sqlpartition

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package sqlpartition implements a store which converts a request to partitions based on the user's rbac for the resource. For example, a user may request all items of resource A, but only have permissions for resource A in namespaces x,y,z. The partitions will then store that information and be passed to the next store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Partitioner

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

Partitioner is an interface for interacting with partitions.

type SchemaColumnSetter

type SchemaColumnSetter interface {
	SetColumns(ctx context.Context, schema *types.APISchema) error
}

type Store

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

Store implements types.proxyStore for partitions.

func NewStore

NewStore creates a types.proxyStore implementation with a partitioner

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)
	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)

	ListByPartitions(apiOp *types.APIRequest, schema *types.APISchema, partitions []partition.Partition) ([]unstructured.Unstructured, int, string, error)
	WatchByPartitions(apiOp *types.APIRequest, schema *types.APISchema, wr types.WatchRequest, partitions []partition.Partition) (chan watch.Event, error)
}

UnstructuredStore is like types.Store but deals in k8s unstructured objects instead of apiserver types. This interface exists in order for store to be mocked in tests

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