storage

package
v0.0.0-...-6b04d54 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogObjectAPI

func NewLogObjectAPI(c *config.ObjStorageConfig) (*objAPIServer, error)

func NewObjectAPI

func NewObjectAPI(c *config.ObjStorageConfig) (*objAPIServer, error)

func NewTypedAPIServer

func NewTypedAPIServer(c *config.ObjStorageConfig, kind ObjectType) (*objAPIServer, error)

Types

type Client

type Client interface {
	// Writer returns a writer which writes to an object.
	Writer(name string) (io.WriteCloser, error)

	// Reader returns a reader which reads from an object.
	Reader(name string, offset int64, size int64) (io.ReadCloser, error)

	// Delete deletes an object.
	Delete(name string) error

	// Size of the object
	Size(name string) (int64, error)

	// Check if object exists
	Exists(name string) bool

	// IsNotExist returns true if err is a non existence error
	IsNotExist(err error) bool

	// return a signed url for given http method
	SignedURL(op, objname string) (string, error)

	// merge objects
	Merge(parentDir, dest string, src []string) error
}

func NewClient

func NewClient(objConfig *config_pkg.ObjStorageConfig) (Client, error)

func NewGcsClient

func NewGcsClient(c *config_pkg.ObjStorageConfig) (Client, error)

func NewS3Client

func NewS3Client(c *config_pkg.ObjStorageConfig) (Client, error)

type ObjectAPIServer

type ObjectAPIServer interface {
	BasePath() string
	GetObjectPath(name string) string

	Reader(path string, offset int64, size int64) (io.ReadCloser, error)
	Writer(path string) (io.WriteCloser, error)
	ReadSeeker(path string, offset int64, size int64) (io.ReadSeeker, error)

	NewObjectHash() string
	CreateObject(fileReader io.Reader, inchunks bool) (string, string, int64, error)
	SaveObject(name string, subdir string, fileReader io.Reader, inchunks bool) (path string, chksm string, written int64, fnerr error)
	GetObject(name string, offset int64, size int64) ([]byte, int, error)

	ObjectURL(op, name string) (string, error)
	ObjectSize(name string) int64
	GetSizeByPath(path string) int64

	CheckObject(path string) bool
	DeleteObject(path string) error

	MergeObjects(dest string, src []string) error
}

type ObjectType

type ObjectType string
const (
	Object ObjectType = "objects"
	Log    ObjectType = "logs"
)

Jump to

Keyboard shortcuts

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