storage

package
v0.0.0-...-e89a0ad Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMoreObjects  = errors.New("no more objects")
	ErrProviderClosed = errors.New("provider closed")
)

Functions

func AddDelimiterToPath

func AddDelimiterToPath(path string) string

func DeleteObjectsWhere

func DeleteObjectsWhere(folder Folder, confirm bool, objFilter func(object1 Object) bool, folderFilter func(name string) bool) error

func GetPathFromPrefix

func GetPathFromPrefix(prefix string) (bucket, server string, err error)

func JoinPath

func JoinPath(elem ...string) string

func ParsePrefixAsURL

func ParsePrefixAsURL(prefix string) (bucket, server string, err error)

func RunFolderTest

func RunFolderTest(storageFolder Folder, t *testing.T)

nolint: funlen

Types

type Error

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

func NewError

func NewError(err error, storageName, format string, args ...interface{}) Error

func (Error) Error

func (err Error) Error() string

type Folder

type Folder interface {
	// Path should always ends with '/'
	GetPath() string

	// Should return objects with relative paths
	ListFolder() (objects []Object, subFolders []Folder, err error)

	// Delete object, if exists
	DeleteObjects(objectRelativePaths []string) error

	Exists(objectRelativePath string) (bool, error)

	// Returns handle to subfolder. Does not have to instantiate subfolder in any material form
	GetSubFolder(subFolderRelativePath string) Folder

	// Should return ObjectNotFoundError in case, there is no such object
	ReadObject(objectRelativePath string) (io.ReadCloser, error)

	PutObject(name string, content io.Reader) error

	CopyObject(srcPath string, dstPath string) error
}

type LocalObject

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

func NewLocalObject

func NewLocalObject(name string, lastModified time.Time, size int64) *LocalObject

func (LocalObject) GetLastModified

func (object LocalObject) GetLastModified() time.Time

func (LocalObject) GetName

func (object LocalObject) GetName() string

func (LocalObject) GetSize

func (object LocalObject) GetSize() int64

type Object

type Object interface {
	GetName() string
	GetLastModified() time.Time
	GetSize() int64
}

func ListFolderRecursively

func ListFolderRecursively(folder Folder) (relativePathObjects []Object, err error)

func ListFolderRecursivelyWithFilter

func ListFolderRecursivelyWithFilter(folder Folder, folderSelector func(path string) bool) (relativePathObjects []Object, err error)

func ListFolderRecursivelyWithPrefix

func ListFolderRecursivelyWithPrefix(folder Folder, prefix string) (relativePathObjects []Object, err error)

type ObjectNotFoundError

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

func NewObjectNotFoundError

func NewObjectNotFoundError(path string) ObjectNotFoundError

func (ObjectNotFoundError) Error

func (err ObjectNotFoundError) Error() string

type ObjectProvider

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

func NewLowMemoryObjectProvider

func NewLowMemoryObjectProvider() *ObjectProvider

func (*ObjectProvider) AddError

func (p *ObjectProvider) AddError(err error) bool

func (*ObjectProvider) AddObject

func (p *ObjectProvider) AddObject(o Object) error

func (*ObjectProvider) Close

func (p *ObjectProvider) Close()

func (*ObjectProvider) GetObject

func (p *ObjectProvider) GetObject() (Object, error)

func (*ObjectProvider) HandleError

func (p *ObjectProvider) HandleError(err error)

func (*ObjectProvider) ObjectsCount

func (p *ObjectProvider) ObjectsCount() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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