driver

package
v0.0.0-...-bb7e8d2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FileDriverName = "File"
)
View Source
const (
	GCSDriverName = "GCS"
)

Variables

View Source
var (
	//ErrIndexNotFound indicates that an index is not found
	ErrIndexNotFound = errors.New("index: not found")
	// ErrIndexExists indicates that a release already exists.
	ErrIndexExists = errors.New("index: already exists")
	// ErrDeletingIndex indicates that a release already exists.
	ErrDeletingIndex = errors.New("index: failed to delete")
	// ErrDeletingIndex indicates that a release already exists.
	ErrUnknown = errors.New("unknown failure")
)

Functions

This section is empty.

Types

type Creator

type Creator interface {
	Create(idx *v1.WatcherDetails) error
}

// Creator is the interface that wraps the Create method. // // Create stores the index or returns ErrIndexExists // if an identical index already exists.

type Deletor

type Deletor interface {
	Delete(string) (*v1.WatcherDetails, error)
}

// Delete is the interface that wraps the Delete method. // // Delete remove the index or returns ErrIndexNotFound // if

type Driver

type Driver interface {
	Creator
	Deletor
	Updator
	Queryor
	Name() string
}

Driver is the interface composed of Creator, Updator, interfaces. It defines the behavior for storing, updating, the watcher index from some underlying storage mechanism, e.g. gcs, local disk.

type File

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

func NewFile

func NewFile(folder string) (*File, error)

func (*File) Create

func (f *File) Create(idx *v1.WatcherDetails) error

func (*File) Delete

func (f *File) Delete(id string) (*v1.WatcherDetails, error)

func (*File) Get

func (f *File) Get(id string) (*v1.WatcherDetails, error)

func (*File) GetInfo

func (f *File) GetInfo(p string) (*v1.WatcherDetails, error)

func (*File) List

func (f *File) List() ([]*v1.WatcherDetails, error)
func (f *File) List(filter func (*v1.WatcherDetails) bool) ([]*v1.WatcherDetails, error) {
	return nil, nil
}

func (*File) Name

func (f *File) Name() string

func (*File) Update

func (f *File) Update(idx *v1.WatcherDetails) error

type GCS

type GCS struct {
	Client *gcp.HTTPClient
	// contains filtered or unexported fields
}

func NewGCS

func NewGCS(bucket string) (*GCS, error)

instantiate new GCS driver

func (*GCS) Create

func (g *GCS) Create(idx *v1.WatcherDetails) error

func (*GCS) Delete

func (g *GCS) Delete(id string) (watcher *v1.WatcherDetails, err error)

func (*GCS) Get

func (g *GCS) Get(id string) (*v1.WatcherDetails, error)

func (*GCS) GetInfo

func (g *GCS) GetInfo(p string) (*v1.WatcherDetails, error)

func (*GCS) List

func (g *GCS) List() ([]*v1.WatcherDetails, error)

func (*GCS) Name

func (g *GCS) Name() string

func (*GCS) Update

func (g *GCS) Update(idx *v1.WatcherDetails) error

type Queryor

type Queryor interface {
	Get(string) (*v1.WatcherDetails, error)
	GetInfo(string) (*v1.WatcherDetails, error)
	// Get(key string) (*index.Watch, error)
	List() ([]*v1.WatcherDetails, error)
}

Queryor is the interface that wraps the Get and List methods.

Get returns the index named by key or returns ErrIndexNotFound if the index does not exist.

List returns the set of all index that satisfy the filter predicate.

Query returns the set of all index that match the provided label set.

type StoreDriverError

type StoreDriverError struct {
	IndexName string
	Err       error
}

func (*StoreDriverError) Error

func (e *StoreDriverError) Error() string

func (*StoreDriverError) Unwrap

func (e *StoreDriverError) Unwrap() error

type Updator

type Updator interface {
	Update(idx *v1.WatcherDetails) error
}

Updator is the interface that wraps the Update method.

Update updates an existing index or returns ErrIndexNotFound if the index does not exist.

Jump to

Keyboard shortcuts

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