minio

package
v0.0.2-alpha Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PreSignedExpiresOneHour = time.Hour
	PreSignedExpiresOneDay  = time.Hour * 24
	PreSignedExpiresMin     = time.Second
	PreSignedExpiresMax     = time.Hour * 24 * 7 // store 对象存储获取URL最长时间为7天
)

Variables

This section is empty.

Functions

func MinIOExtractToDir

func MinIOExtractToDir(c context.Context, minioClient *Client, sourceBucket string, sourceFilePath string, targetBucket string, targetFilePath string) error

Types

type BlockUpload

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

分块上传 (partSize>=5M)

func NewBlockUpload

func NewBlockUpload(client *Client, tmpBucketName string) (*BlockUpload, error)

func (*BlockUpload) ComposeObject

func (b *BlockUpload) ComposeObject(ctx context.Context, objectname string, contentType string, metadata ...map[string]string) (*minio.UploadInfo, error)

func (*BlockUpload) RemoveTmpBlock

func (b *BlockUpload) RemoveTmpBlock(ctx context.Context)

func (*BlockUpload) Upload

func (b *BlockUpload) Upload(ctx context.Context, r io.Reader, objectSize int64) error

type Client

type Client struct {
	Host      string // "ip + port"
	AccessKey string // 访问用户
	Secret    string // 访问密钥
	Bucket    string // 桶名称
}

func (*Client) CreateEmptyDir

func (store *Client) CreateEmptyDir(ctx context.Context, filePath string) error

func (*Client) DownloadAOSObject

func (store *Client) DownloadAOSObject(ctx context.Context, remotePath, localPath string) (err error)

func (*Client) GetAOSObjURL

func (store *Client) GetAOSObjURL(ctx context.Context, filePath string, expires time.Duration) (u *url.URL, err error)

func (*Client) GetAOSObject

func (store *Client) GetAOSObject(ctx context.Context, filePath string) (obj *minio.Object, err error)

func (*Client) GetObjectTags

func (store *Client) GetObjectTags(ctx context.Context, objectName string) (map[string]string, error)

func (*Client) ListBuckets

func (store *Client) ListBuckets(ctx context.Context) ([]minio.BucketInfo, error)

func (*Client) ListObjects

func (store *Client) ListObjects(ctx context.Context, prefix string) (<-chan minio.ObjectInfo, error)

func (*Client) PutObjectTags

func (store *Client) PutObjectTags(ctx context.Context, objectName string, tagMap map[string]string) error

func (*Client) RemoveObject

func (store *Client) RemoveObject(ctx context.Context, objectName string) error

func (*Client) RenameObject

func (store *Client) RenameObject(ctx context.Context, objectName, newBucket, newObjectName string) (minio.UploadInfo, error)

func (*Client) SetBucket

func (store *Client) SetBucket(bucket string) *Client

func (*Client) StatObject

func (store *Client) StatObject(ctx context.Context, filePath string) (objInfo minio.ObjectInfo, err error)

func (*Client) Upload

func (store *Client) Upload(ctx context.Context, objectName, filePath, contentType string, metadata ...map[string]string) (minio.UploadInfo, error)

func (*Client) UploadStream

func (store *Client) UploadStream(ctx context.Context, objectName string, r io.Reader, objectSize int64, contentType string, metadata ...map[string]string) (minio.UploadInfo, error)

type MultipartUpload

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

多部分上传 (partSize>=5M)

func NewMultipartUpload

func NewMultipartUpload(client *Client, objectName string) (*MultipartUpload, error)

func (*MultipartUpload) Complate

func (mpu *MultipartUpload) Complate(ctx context.Context, contentType string) (minio.ObjectInfo, error)

func (*MultipartUpload) UploadPart

func (mpu *MultipartUpload) UploadPart(ctx context.Context, r io.Reader, partSize int64) error

Jump to

Keyboard shortcuts

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