storage

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminEnvironmentNamespace = ""

	OrderDirectionAsc  OrderDirection = 0
	OrderDirectionDesc OrderDirection = 1

	// use 0 instead of -1 because it's used for cap to make slice in storage lister.
	QueryUnlimited = 0
)

Variables

View Source
var (
	ErrConcurrentTransaction = errors.New("storage: concurrent transaction in progress")
	ErrKeyAlreadyExists      = errors.New("storage: key already exists")
	ErrKeyNotFound           = errors.New("storage: key not found")
	ErrIteratorDone          = errors.New("storage: iterator is done")
	ErrInvalidCursor         = errors.New("storage: cursor is invalid")
	ErrBucketNotExist        = errors.New("storage: bucket doesn't exist")
	ErrObjectNotExist        = errors.New("storage: object doesn't exist")
	ErrEmptyName             = errors.New("storage: name is empty")
	ErrInvalidName           = errors.New("storage: invalid name")
)

Functions

This section is empty.

Types

type Bucket

type Bucket interface {
	Object
}

type Client

type Client interface {
	GetPutter
	Deleter
	Querier
	RunInTransaction(ctx context.Context, f func(t Transaction) error) error
	Close()
}

type Deleter

type Deleter interface {
	Delete(ctx context.Context, key *Key) error
}

type Filter

type Filter struct {
	Property string
	Operator string
	Value    interface{}
}

func NewFilter

func NewFilter(property, operator string, value interface{}) *Filter

type GetPutter

type GetPutter interface {
	Getter
	Putter
}

type Getter

type Getter interface {
	Get(ctx context.Context, key *Key, dst interface{}) error
	GetMulti(ctx context.Context, keys []*Key, dst interface{}) error
}

type Iterator

type Iterator interface {
	Next(dst interface{}) error
	Cursor() (string, error)
}

type Key

type Key struct {
	ID   string
	Kind string
	// If it is empty string, query will be executed in admin namespace.
	// If not, query will be executed in namespace for target environment.
	EnvironmentNamespace string
}

func NewKey

func NewKey(id, kind, environmentNamespace string) *Key

type MultiError

type MultiError []error

MultiError is returned by batch operations when there are errors with particular elements. Errors will be in a one-to-one correspondence with the input elements; successful elements will have a nil entry.

func (MultiError) Error

func (m MultiError) Error() string

type Object

type Object interface {
	Writer(ctx context.Context, environmentNamespace, filename string, CRC32C uint32) (Writer, error)
	Reader(ctx context.Context, environmentNamespace, filename string) (Reader, error)
	Deleter
}

type ObjectStorageClient

type ObjectStorageClient interface {
	Bucket(ctx context.Context, bucket string) (Bucket, error)
	Close()
}

type Order

type Order struct {
	Property  string
	Direction OrderDirection
}

func NewOrder

func NewOrder(property string, direction OrderDirection) *Order

type OrderDirection

type OrderDirection int

type Putter

type Putter interface {
	Put(ctx context.Context, key *Key, src interface{}) error
	PutMulti(ctx context.Context, keys []*Key, src interface{}) error
}

type Querier

type Querier interface {
	RunQuery(ctx context.Context, query Query) (Iterator, error)
}

type Query

type Query struct {
	Kind        string
	Limit       int
	StartCursor string
	Orders      []*Order
	Filters     []*Filter
	// If it is empty string, query will be executed in admin namespace.
	// If not, query will be executed in namespace for target environment.
	EnvironmentNamespace string
}

type Reader

type Reader interface {
	io.ReadCloser
}

type Transaction

type Transaction interface {
	GetPutter
	Deleter
}

type Writer

type Writer interface {
	io.WriteCloser
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
v2
mysql
nolint:lll
nolint:lll
mysql/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
postgres/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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