storage

package
v0.0.0-...-10408e1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDelimiterToPath

func AddDelimiterToPath(path string) string

func DeleteObjectsWhere

func DeleteObjectsWhere(folder Folder, confirm bool, filter func(object1 Object) bool) error

func GetPathFromPrefix

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

TODO : unit tests

func JoinPath

func JoinPath(elem ...string) string

func ParsePrefixAsURL

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

TODO : unit tests

func RunFolderTest

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

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
}

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)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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