store

package
v0.20.9 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventAdd add event
	EventAdd = "add"
	// EventUpdate update event
	EventUpdate = "update"
	// EventDelete delete event
	EventDelete = "delete"
	// EventClose close event
	EventClose = "close"
	// EventError err event
	EventError = "error"
)

Variables

View Source
var (
	// ErrObjectNotFound error for object not found
	ErrObjectNotFound = errors.New("object not found")
	// ErrObjectExists error for object exists
	ErrObjectExists = errors.New("object already exists")
)

Functions

This section is empty.

Types

type CreateOptions

type CreateOptions struct {
	// UpdateExists if do update when exists
	UpdateExists bool
	Env          string
}

CreateOptions options for create operation

type DeleteOptions

type DeleteOptions struct {
	// IgnoreNotFound if return err when data not found
	IgnoreNotFound bool
	Env            string
}

DeleteOptions options for delete operation

type Event

type Event struct {
	Type EventType
	Obj  *types.RawObject
}

Event event for store watch

type EventType

type EventType string

EventType event type for store

type GetOptions

type GetOptions struct {
	Env string
}

GetOptions options for get operation

type ListOptions

type ListOptions struct {
	Selector  *types.ValueSelector
	Cluster   string
	Namespace string
	Offset    int64
	Limit     int64
	Env       string
}

ListOptions options for list operation

type Store

type Store interface {
	Get(ctx context.Context, t types.ObjectType, key types.ObjectKey, opt *GetOptions) (*types.RawObject, error)
	Create(ctx context.Context, obj *types.RawObject, opt *CreateOptions) error
	Update(ctx context.Context, obj *types.RawObject, opt *UpdateOptions) error
	Delete(ctx context.Context, obj *types.RawObject, opt *DeleteOptions) error
	List(ctx context.Context, objectType types.ObjectType, opts *ListOptions) ([]*types.RawObject, error)
	Watch(ctx context.Context, resourceType types.ObjectType, opts *WatchOptions) (chan *Event, error)
}

Store interface for store object

type UpdateOptions

type UpdateOptions struct {
	// CreateNotExists if do creation when not exists
	CreateNotExists bool
	Env             string
}

UpdateOptions options for update operation

type WatchOptions

type WatchOptions struct {
	Selector     *types.ValueSelector
	BatchSize    int32
	MaxAwaitTime time.Duration
	StartTime    *WatchStartTimeStamp
	Env          string
}

WatchOptions options for watch operation

type WatchStartTimeStamp

type WatchStartTimeStamp struct {
	T uint32
	I uint32
}

WatchStartTimeStamp start time stamp for watch

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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