storage

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserIDMustNotBeEmpty = errors.New("userID must not be empty")
	ErrUserIDMustBeEmpty    = errors.New("userID must be empty")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	CommonIndexClient
	UserIndexClient

	ListTables(ctx context.Context) ([]string, error)
	IsFileNotFoundErr(err error) bool
	Stop()
}

Client is used to manage boltdb index files in object storage, when using boltdb-shipper.

func NewIndexStorageClient

func NewIndexStorageClient(origObjectClient chunk.ObjectClient, storagePrefix string) Client

type CommonIndexClient

type CommonIndexClient interface {
	ListFiles(ctx context.Context, tableName string) ([]IndexFile, []string, error)
	GetFile(ctx context.Context, tableName, fileName string) (io.ReadCloser, error)
	PutFile(ctx context.Context, tableName, fileName string, file io.ReadSeeker) error
	DeleteFile(ctx context.Context, tableName, fileName string) error
}

CommonIndexClient allows doing operations on the object store for common index.

type IndexFile

type IndexFile struct {
	Name       string
	ModifiedAt time.Time
}

type IndexSet

type IndexSet interface {
	ListFiles(ctx context.Context, tableName, userID string) ([]IndexFile, error)
	GetFile(ctx context.Context, tableName, userID, fileName string) (io.ReadCloser, error)
	PutFile(ctx context.Context, tableName, userID, fileName string, file io.ReadSeeker) error
	DeleteFile(ctx context.Context, tableName, userID, fileName string) error
	IsFileNotFoundErr(err error) bool
	IsUserBasedIndexSet() bool
}

IndexSet provides storage operations for user or common index tables.

func NewIndexSet

func NewIndexSet(client Client, userBasedIndex bool) IndexSet

NewIndexSet handles storage operations based on the value of indexSet.userBasedIndex

type UserIndexClient

type UserIndexClient interface {
	ListUserFiles(ctx context.Context, tableName, userID string) ([]IndexFile, error)
	GetUserFile(ctx context.Context, tableName, userID, fileName string) (io.ReadCloser, error)
	PutUserFile(ctx context.Context, tableName, userID, fileName string, file io.ReadSeeker) error
	DeleteUserFile(ctx context.Context, tableName, userID, fileName string) error
}

UserIndexClient allows doing operations on the object store for user specific index.

Jump to

Keyboard shortcuts

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