cont

package
v0.0.49-alpha.43 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// DirectPath indicates the directory for direct uploads or access within the 'openim' structure.
	DirectPath = "openim/direct"

	// UploadTypeMultipart represents the identifier for multipart uploads,
	// allowing large files to be uploaded in chunks.
	UploadTypeMultipart = 1

	// UploadTypePresigned signifies the use of presigned URLs for uploads,
	// facilitating secure, authorized file transfers without requiring direct access to the storage credentials.
	UploadTypePresigned = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func New

func New(cache S3Cache, impl s3.Interface) *Controller

func (*Controller) AccessURL

func (c *Controller) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error)

func (*Controller) AuthSign

func (c *Controller) AuthSign(ctx context.Context, uploadID string, partNumbers []int) (*s3.AuthSignResult, error)

func (*Controller) CompleteUpload

func (c *Controller) CompleteUpload(ctx context.Context, uploadID string, partHashs []string) (*UploadResult, error)

func (*Controller) DeleteObject added in v0.0.49

func (c *Controller) DeleteObject(ctx context.Context, name string) error

func (*Controller) Engine

func (c *Controller) Engine() string

func (*Controller) FormData

func (c *Controller) FormData(ctx context.Context, name string, size int64, contentType string, duration time.Duration) (*s3.FormData, error)

func (*Controller) GetHashObject

func (c *Controller) GetHashObject(ctx context.Context, hash string) (*s3.ObjectInfo, error)

func (*Controller) GetImageThumbnailKey

func (c *Controller) GetImageThumbnailKey(ctx context.Context, name string) (string, error)

func (*Controller) HashPath

func (c *Controller) HashPath(md5 string) string

func (*Controller) InitiateUpload

func (c *Controller) InitiateUpload(ctx context.Context, hash string, size int64, expire time.Duration, maxParts int) (*InitiateUploadResult, error)

func (*Controller) IsNotFound

func (c *Controller) IsNotFound(err error) bool

func (*Controller) NowPath

func (c *Controller) NowPath() string

func (*Controller) PartLimit

func (c *Controller) PartLimit() *s3.PartLimit

func (*Controller) PartSize

func (c *Controller) PartSize(ctx context.Context, size int64) (int64, error)

func (*Controller) StatObject

func (c *Controller) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, error)

func (*Controller) UUID

func (c *Controller) UUID() string

type HashAlreadyExistsError

type HashAlreadyExistsError struct {
	Object *s3.ObjectInfo
}

func (*HashAlreadyExistsError) Error

func (e *HashAlreadyExistsError) Error() string

type InitiateUploadResult

type InitiateUploadResult struct {
	// UploadID uniquely identifies the upload session for tracking and management purposes.
	UploadID string `json:"uploadID"`

	// PartSize specifies the size of each part in a multipart upload. This is relevant for breaking down large uploads into manageable pieces.
	PartSize int64 `json:"partSize"`

	// Sign contains the authentication and signature information necessary for securely uploading each part. This could include signed URLs or tokens.
	Sign *s3.AuthSignResult `json:"sign"`
}

type S3Cache

type S3Cache interface {
	GetKey(ctx context.Context, engine string, key string) (*s3.ObjectInfo, error)
	DelS3Key(ctx context.Context, engine string, keys ...string) error
}

type UploadResult

type UploadResult struct {
	Hash string `json:"hash"`
	Size int64  `json:"size"`
	Key  string `json:"key"`
}

Jump to

Keyboard shortcuts

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