storage

package
v0.0.0-...-e964040 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchKey = errors.New("NoSuchKey: The specified key does not exist.")

Functions

func CheckBucketName

func CheckBucketName(v string) error

CheckBucketName check the compliance of the bucket name.

func CheckObjectNameV1

func CheckObjectNameV1(v string) error

CheckObjectNameV1 check the compliance of the object name.

func CheckObjectNameV2

func CheckObjectNameV2(v string) error

CheckObjectNameV2 check the compliance of the object name with CheckObjectNameV1 and verify if the object name ends with '/'.

Types

type Client

type Client interface {
	// PutObject put object to storage
	PutObject(input ObjectInput, opts ...func(o *PutOptions)) error
	// PutFolder put files in folder to storage
	PutFolder(bucket string, prefix string, root string, opts ...func(o *PutOptions)) error

	// GetObject get object
	GetObject(bucket string, key string, opts ...func(o *GetOptions)) (*ObjectOutputHook, error)
	// GetObjectsWithIterator get object list
	GetObjectsWithIterator(bucket string, prefix string, iterator func(keys []*string) error, opts ...func(o *ListOptions)) error

	// DelObject delete object with key
	DelObject(bucket string, key string, opts ...func(o *DelOptions)) error
	// DelPrefix delete object list with prefix
	DelPrefix(bucket string, prefix string, opts ...func(o *DelOptions)) error

	// Copy copy Object to target
	// If the source is prefixed, copy all the objects
	Copy(src Position, dst Position, opts ...func(o *CopyOptions)) error

	// IsExist query whether the object exists
	// If the query is prefixed, the key needs to end with '/'
	IsExist(bucket string, key string, opts ...func(o *GetOptions)) (bool, error)

	// Presign url of object
	Presign(bucket string, key string, opts ...func(o *PresignOptions)) (string, error)

	// Compress compress object into '*.tar.gz'
	// If compressing multiple objects, the key needs to end with '/'
	Compress(bucket string, key string, dst io.Writer, opts ...func(o *ListOptions)) error
}

type CopyOptions

type CopyOptions struct {
	// Context .
	Context context.Context
}

CopyOptions .

func NewCopyOptions

func NewCopyOptions(opts ...func(o *CopyOptions)) *CopyOptions

NewCopyOptions .

type DelOptions

type DelOptions struct {
	// Context .
	Context context.Context
	// VersionID version id
	VersionID string
}

DelOptions .

func NewDelOptions

func NewDelOptions(opts ...func(o *DelOptions)) *DelOptions

NewDelOptions .

type Factory

type Factory struct {
	// Concurrency The number of goroutines
	Works int
	// contains filtered or unexported fields
}

Factory .

func NewFactory

func NewFactory(options ...func(f *Factory)) *Factory

NewFactory .

func (*Factory) Closing

func (f *Factory) Closing()

Closing .

func (*Factory) Flowline

func (f *Factory) Flowline(fn func(v interface{}))

Flowline .

func (*Factory) Push

func (f *Factory) Push(v interface{})

Push .

func (*Factory) PushSlice

func (f *Factory) PushSlice(keys []*string)

PushSlice .

func (*Factory) Wait

func (f *Factory) Wait()

Wait .

type GetOptions

type GetOptions struct {
	// Context .
	Context context.Context
	// VersionID object version
	VersionID string
}

GetOptions .

func NewGetOptions

func NewGetOptions(opts ...func(o *GetOptions)) *GetOptions

NewGetOptions .

type ListOptions

type ListOptions struct {
	// Context .
	Context context.Context
	// MaxKeys .
	MaxKeys int
	// Recursive Ignore '/' delimiter
	Recursive bool
}

ListOptions .

func NewListOptions

func NewListOptions(opts ...func(o *ListOptions)) *ListOptions

NewListOptions .

type ObjectInput

type ObjectInput interface {
	Bucket() string
	Key() string
	ContentType() string
	Close() error
	Error() error
	Body() io.ReadSeeker
}

func InputBoolean

func InputBoolean(bucket string, key string, v bool) ObjectInput

InputBoolean .

func InputFile

func InputFile(bucket string, key string, file string) ObjectInput

InputFile .

func InputMarshalJson

func InputMarshalJson(bucket string, key string, vPointer interface{}) ObjectInput

InputMarshalJson .

func InputMarshalProto

func InputMarshalProto(bucket string, key string, v proto.Message) ObjectInput

InputMarshalProto .

func InputNumber

func InputNumber(bucket string, key string, v interface{}) ObjectInput

InputNumber .

func InputReadSeeker

func InputReadSeeker(bucket string, key string, body io.ReadSeeker) ObjectInput

InputReadSeeker .

func InputString

func InputString(bucket string, key string, v string) ObjectInput

InputString .

type ObjectOutput

type ObjectOutput interface {
	Bucket() string
	Key() string
	ContentType() content.Type
	Decode(vPointer interface{}) error
	Body() io.ReadCloser
	Close() error
}

func OutputReadCloser

func OutputReadCloser(bucket string, key string, contenttype string, body io.ReadCloser) ObjectOutput

OutputReadCloser .

type ObjectOutputHook

type ObjectOutputHook struct {
	// Fetch get object with io.ReadCloser
	Fetch func(hook func(output ObjectOutput) error) error
	// Write write object to io.WriterAt
	Write func(w io.WriterAt) error
}

type Options

type Options struct {
	// Context context
	Context context.Context
	// Timeout 连接超时时间
	Timeout time.Duration
	// Region region
	Region string
	// SSL use ssl
	UseSSL bool
}

Options .

func NewOptions

func NewOptions(opts ...func(o *Options)) *Options

NewOptions .

type Position

type Position interface {
	Bucket() string
	Path() string
	IsPrefix() bool
}

func PositionRemote

func PositionRemote(bucket, path string) Position

PositionRemote .

type PresignOptions

type PresignOptions struct {
	// Context .
	Context context.Context
	// VersionID data version
	VersionID string
	// Expires expires time (s)
	Expires time.Duration
}

PresignOptions .

func NewPresignOptions

func NewPresignOptions(opts ...func(o *PresignOptions)) *PresignOptions

NewPresignOptions .

type PutOptions

type PutOptions struct {
	// Context .
	Context context.Context
}

PutOptions .

func NewPutOptions

func NewPutOptions(opts ...func(o *PutOptions)) *PutOptions

NewPutOptions .

type Type

type Type string
const StorageTypeS3 Type = "s3"

func (Type) String

func (t Type) String() string

String .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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