types

package
v0.0.0-...-0085ac7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupportByBackend = errors.New("operation not supported by backend")
)

Functions

This section is empty.

Types

type AbortMultipartUploadOpts

type AbortMultipartUploadOpts struct {
	Path     string
	UploadID string
}

type CompleteMultipartUploadOpts

type CompleteMultipartUploadOpts struct {
	Path           string
	UploadID       string
	CompletedParts []CompletedPart
}

type CompletedPart

type CompletedPart struct {
	ETag       string `xml:"ETag" json:"ETag"`
	Size       int64  `xml:"Size" json:"Size"`
	PartNumber int32  `xml:"PartNumber" json:"PartNumber"`
}

CompletedPart represents a part that has been uploaded

type CreateMultipartUploadOpts

type CreateMultipartUploadOpts struct {
	Path string
}

type CreateMultipartUploadResult

type CreateMultipartUploadResult struct {
	UploadID string
}

type DeleteOpts

type DeleteOpts struct {
	Path string
}

type DownloadOpts

type DownloadOpts struct {
	Path   string
	Writer io.WriterAt
	Start  int64
	End    int64
}

type DownloadResult

type DownloadResult struct {
	BytesWritten int64
}

type GeneratePresignedUploadURLOpts

type GeneratePresignedUploadURLOpts struct {
	Path       string
	Expires    time.Duration
	UploadID   string
	PartNumber int32
}

type GeneratePresignedUploadURLResult

type GeneratePresignedUploadURLResult struct {
	URL string
}

type ListOpts

type ListOpts struct {
	Path string
}

type ListResult

type ListResult struct {
	Objects []Object
}

type Metadata

type Metadata struct {
	Name    string
	Version string
}

Metadata represents the meta information of the object includes object name , object version , etc...

type MoveOpts

type MoveOpts struct {
	FromPath string
	ToPath   string
}

type Object

type Object struct {
	Meta         Metadata
	Path         string
	LastModified time.Time
}

Object is a generic representation of a storage object

func (Object) HasExtension

func (object Object) HasExtension(extension string) bool

HasExtension determines whether or not an object contains a file extension

type ObjectSliceDiff

type ObjectSliceDiff struct {
	Change  bool
	Removed []Object
	Added   []Object
	Updated []Object
}

ObjectSliceDiff provides information on what has changed since last calling ListObjects

type StatOpts

type StatOpts struct {
	Path string
}

type StatResult

type StatResult struct {
	Object Object
}

type Storage

type Storage interface {
	List(ctx context.Context, opts *ListOpts) (*ListResult, error)
	Download(ctx context.Context, opts *DownloadOpts) (*DownloadResult, error)
	Upload(ctx context.Context, opts *UploadOpts) error
	Stat(ctx context.Context, opts *StatOpts) (*StatResult, error)
	Delete(ctx context.Context, opts *DeleteOpts) error
	Move(ctx context.Context, opts *MoveOpts) error
	CreateMultipartUpload(ctx context.Context, opts *CreateMultipartUploadOpts) (*CreateMultipartUploadResult, error)
	UploadPart(ctx context.Context, opts *UploadPartOpts) (*UploadPartResult, error)
	CompleteMultipartUpload(ctx context.Context, opts *CompleteMultipartUploadOpts) error
	AbortMultipartUpload(ctx context.Context, opts *AbortMultipartUploadOpts) error
	GeneratePresignedUploadURL(ctx context.Context, opts *GeneratePresignedUploadURLOpts) (*GeneratePresignedUploadURLResult, error)
}

Storage is a generic interface for storage backends

type UploadOpts

type UploadOpts struct {
	Path   string
	Reader io.Reader
}

type UploadPartOpts

type UploadPartOpts struct {
	Path       string
	UploadID   string
	PartNumber int32
	Reader     io.ReadSeeker
	Size       int64
}

type UploadPartResult

type UploadPartResult struct {
	CompletedPart CompletedPart
}

Jump to

Keyboard shortcuts

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