store

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultPage     = 1
	DefaultPageSize = 100
	MaxPageSize     = 1000
)
View Source
const DefaultOperationTimeout = 15 * time.Second

Variables

View Source
var (
	ErrNotFound = fmt.Errorf("not found")
)

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct{}

type CreateOptsFunc

type CreateOptsFunc func(*CreateOpts)

type DeleteOpts

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

func NewDeleteOpts

func NewDeleteOpts(fns ...DeleteOptsFunc) *DeleteOpts

type DeleteOptsFunc

type DeleteOptsFunc func(*DeleteOpts)

func DeleteByID

func DeleteByID(id string) DeleteOptsFunc

func DeleteByType

func DeleteByType(typ model.Type) DeleteOptsFunc

type ErrConstraint

type ErrConstraint struct {
	Index   model.Index
	Message string
}

func (ErrConstraint) Error

func (e ErrConstraint) Error() string

type ErrUnsupportedListOpts

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

ErrUnsupportedListOpts is used when the provided combination of list options is not supported.

func (ErrUnsupportedListOpts) Error

func (e ErrUnsupportedListOpts) Error() string

type ListOpts

type ListOpts struct {
	ReferenceType model.Type
	ReferenceID   string
	PageSize      int
	Page          int

	// CEL expression used for filtering.
	// Read more: https://github.com/google/cel-spec
	Filter *exprpb.Expr
}

func NewListOpts

func NewListOpts(fns ...ListOptsFunc) (*ListOpts, error)

NewListOpts executes the provided list option functions, validates that all set options are compatible with each other, and returns the generated ListOpts.

type ListOptsFunc

type ListOptsFunc func(*ListOpts)

func ListFor

func ListFor(typ model.Type, id string) ListOptsFunc

func ListWithFilter

func ListWithFilter(expr *exprpb.Expr) ListOptsFunc

ListWithFilter associates the passed in CEL expression with the current list pagination options.

func ListWithPageNum

func ListWithPageNum(page int) ListOptsFunc

func ListWithPageSize

func ListWithPageSize(pageSize int) ListOptsFunc

type ObjectStore

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

ObjectStore stores objects. TODO(hbagdi): better name needed between this and the interface.

func New

func New(persister persistence.Persister, logger *zap.Logger) *ObjectStore

func (*ObjectStore) Create

func (s *ObjectStore) Create(ctx context.Context, object model.Object,
	_ ...CreateOptsFunc,
) error

func (*ObjectStore) Delete

func (s *ObjectStore) Delete(ctx context.Context,
	opts ...DeleteOptsFunc,
) error

func (*ObjectStore) ForCluster

func (s *ObjectStore) ForCluster(cluster string) *ObjectStore

func (*ObjectStore) List

func (s *ObjectStore) List(ctx context.Context, list model.ObjectList, opts ...ListOptsFunc) error

func (*ObjectStore) Read

func (s *ObjectStore) Read(ctx context.Context, object model.Object,
	opts ...ReadOptsFunc,
) error

func (*ObjectStore) Upsert

func (s *ObjectStore) Upsert(ctx context.Context, object model.Object,
	_ ...CreateOptsFunc,
) error

type ReadOpts

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

func NewReadOpts

func NewReadOpts(fns ...ReadOptsFunc) *ReadOpts

type ReadOptsFunc

type ReadOptsFunc func(*ReadOpts)

func GetByID

func GetByID(id string) ReadOptsFunc

func GetByIndex

func GetByIndex(indexName, indexValue string) ReadOptsFunc

func GetByName

func GetByName(name string) ReadOptsFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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