minio

package
v0.0.50-alpha.46-20241209 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, config *Config) error

func ImageStat

func ImageStat(reader io.Reader) (image.Image, string, error)

func ImageWidthHeight

func ImageWidthHeight(img image.Image) (int, int)

Types

type Cache

type Cache interface {
	GetImageObjectKeyInfo(ctx context.Context, key string, fn func(ctx context.Context) (*ImageInfo, error)) (*ImageInfo, error)
	GetThumbnailKey(ctx context.Context, key string, format string, width int, height int, minioCache func(ctx context.Context) (string, error)) (string, error)
	DelObjectImageInfoKey(ctx context.Context, keys ...string) error
	DelImageThumbnailKey(ctx context.Context, key string, format string, width int, height int) error
}

type Config

type Config struct {
	Bucket          string
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
	SignEndpoint    string
	PublicRead      bool
}

type ImageInfo

type ImageInfo struct {
	IsImg  bool   `json:"isImg"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Format string `json:"format"`
	Etag   string `json:"etag"`
}

type Minio

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

func NewMinio

func NewMinio(ctx context.Context, cache Cache, conf Config) (*Minio, error)

func (*Minio) AbortMultipartUpload

func (m *Minio) AbortMultipartUpload(ctx context.Context, uploadID string, name string) error

func (*Minio) AccessURL

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

func (*Minio) AuthSign

func (m *Minio) AuthSign(ctx context.Context, uploadID string, name string, expire time.Duration, partNumbers []int) (*s3.AuthSignResult, error)

func (*Minio) CompleteMultipartUpload

func (m *Minio) CompleteMultipartUpload(ctx context.Context, uploadID string, name string, parts []s3.Part) (*s3.CompleteMultipartUploadResult, error)

func (*Minio) CopyObject

func (m *Minio) CopyObject(ctx context.Context, src string, dst string) (*s3.CopyObjectInfo, error)

func (*Minio) DeleteObject

func (m *Minio) DeleteObject(ctx context.Context, name string) error

func (*Minio) Engine

func (m *Minio) Engine() string

func (*Minio) FormData

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

func (*Minio) GetImageThumbnailKey

func (m *Minio) GetImageThumbnailKey(ctx context.Context, name string) (string, error)

func (*Minio) InitiateMultipartUpload

func (m *Minio) InitiateMultipartUpload(ctx context.Context, name string) (*s3.InitiateMultipartUploadResult, error)

func (*Minio) IsNotFound

func (m *Minio) IsNotFound(err error) bool

func (*Minio) ListUploadedParts

func (m *Minio) ListUploadedParts(ctx context.Context, uploadID string, name string, partNumberMarker int, maxParts int) (*s3.ListUploadedPartsResult, error)

func (*Minio) PartLimit

func (m *Minio) PartLimit() *s3.PartLimit

func (*Minio) PartSize

func (m *Minio) PartSize(ctx context.Context, size int64) (int64, error)

func (*Minio) PresignedGetObject

func (m *Minio) PresignedGetObject(ctx context.Context, name string, expire time.Duration, query url.Values) (string, error)

func (*Minio) PresignedPutObject

func (m *Minio) PresignedPutObject(ctx context.Context, name string, expire time.Duration) (string, error)

func (*Minio) StatObject

func (m *Minio) StatObject(ctx context.Context, name string) (*s3.ObjectInfo, error)

Jump to

Keyboard shortcuts

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