Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ServiceNameS3 is name of s3 storage ServiceNameS3 = "s3" // ServiceNameOSS is name of oss storage ServiceNameOSS = "oss" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketMetadata ¶
type ObjectMetadata ¶
type ObjectMetadata struct { // Key is object key Key string // ContentDisposition is Content-Disposition header ContentDisposition string // ContentEncoding is Content-Encoding header ContentEncoding string // ContentLanguage is Content-Language header ContentLanguage string // ContentLanguage is Content-Length header ContentLength int64 // ContentType is Content-Type header ContentType string // Etag is Etag header Etag string }
type ObjectStorage ¶
type ObjectStorage interface { // GetBucketMetadata returns metadata of bucket. GetBucketMetadata(ctx context.Context, bucketName string) (*BucketMetadata, error) // CreateBucket creates bucket of object storage. CreateBucket(ctx context.Context, bucketName string) error // DeleteBucket deletes bucket of object storage. DeleteBucket(ctx context.Context, bucketName string) error // ListBucketMetadatas returns metadata of buckets. ListBucketMetadatas(ctx context.Context) ([]*BucketMetadata, error) // GetObjectMetadata returns metadata of object. GetObjectMetadata(ctx context.Context, bucketName, objectKey string) (*ObjectMetadata, error) // GetOject returns data of object. GetOject(ctx context.Context, bucketName, objectKey string) (io.ReadCloser, error) // CreateObject creates data of object. CreateObject(ctx context.Context, bucketName, objectKey string, reader io.Reader) error // DeleteObject deletes data of object. DeleteObject(ctx context.Context, bucketName, objectKey string) error // ListObjectMetadatas returns metadata of objects. ListObjectMetadatas(ctx context.Context, bucketName, prefix, marker string, limit int64) ([]*ObjectMetadata, error) }
func New ¶
func New(name, region, endpoint, accessKey, secretKey string) (ObjectStorage, error)
New object storage interface.
Click to show internal directories.
Click to hide internal directories.