storage

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RawPermissionsToMode added in v1.4.0

func RawPermissionsToMode(raw string) fs.FileMode

func RegisterStorage

func RegisterStorage(storageType string, newFunc func(ctx context.Context, v ConfigProvider) (Storage, error))

Types

type ConfigProvider

type ConfigProvider interface {
	GetString(name string) string
	GetInt(name string) int
}

func NewMapConfigProvider

func NewMapConfigProvider(m map[string]interface{}) ConfigProvider

type FileInfo added in v1.4.0

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

func (FileInfo) IsDir added in v1.4.0

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime added in v1.4.0

func (f FileInfo) ModTime() stdtime.Time

func (FileInfo) Mode added in v1.4.0

func (f FileInfo) Mode() fs.FileMode

func (FileInfo) Name added in v1.4.0

func (f FileInfo) Name() string

func (FileInfo) Size added in v1.4.0

func (f FileInfo) Size() int64

func (FileInfo) Sys added in v1.4.0

func (f FileInfo) Sys() any

type Object

type Object struct {
	Key          string
	LastModified stdtime.Time
	Size         int64
	ETag         string
	StorageClass string
	Mode         fs.FileMode
	Headers      http.Header
	Metadata     map[string]string
}

func (Object) Info added in v1.4.0

func (o Object) Info() (fs.FileInfo, error)

func (Object) IsDir added in v1.4.0

func (o Object) IsDir() bool

func (Object) Name added in v1.4.0

func (o Object) Name() string

func (Object) Type added in v1.4.0

func (o Object) Type() fs.FileMode

type ObjectReader

type ObjectReader struct {
	io.ReadCloser
	Object
}

func (ObjectReader) Stat added in v1.4.0

func (o ObjectReader) Stat() (fs.FileInfo, error)

type Storage

type Storage interface {
	fs.ReadDirFS
	json.Marshaler
	Type() string
	Name() string
	ListObject(ctx context.Context, objectPrefix string, recursion bool, callback func(key Object)) error
	HeadObject(ctx context.Context, objectPath string) (obj *Object, err error)
	GetObject(ctx context.Context, objectPath string) (*ObjectReader, error)
	PutObject(ctx context.Context, objectPath string, obj io.Reader, headers http.Header, metadata map[string]string) error
}

func NewClient

func NewClient(ctx context.Context, v ConfigProvider) (Storage, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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