Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ServiceNameS3 is name of s3 storage. ServiceNameS3 = "s3" // ServiceNameOSS is name of oss storage. ServiceNameOSS = "oss" // ServiceNameOBS is name of obs storage. ServiceNameOBS = "obs" )
View Source
const (
// MetaDigest is key of digest meta.
MetaDigest = "digest"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketMetadata ¶
type Method ¶
type Method string
Method is the client operation method .
const ( // MethodHead is the head operation. MethodHead Method = "HEAD" // MethodGet is the get operation. MethodGet Method = "GET" // MethodPut is the put operation. MethodPut Method = "PUT" // MethodPost is the post operation. MethodPost Method = "POST" // MethodDelete is the delete operation. MethodDelete Method = "Delete" // MethodList is the list operation. MethodList Method = "List" )
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 // Digest is object digest. Digest 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) // IsBucketExist returns whether the bucket exists. IsBucketExist(ctx context.Context, bucketName string) (bool, error) // GetObjectMetadata returns metadata of object. GetObjectMetadata(ctx context.Context, bucketName, objectKey string) (*ObjectMetadata, bool, error) // GetOject returns data of object. GetOject(ctx context.Context, bucketName, objectKey string) (io.ReadCloser, error) // PutObject puts data of object. PutObject(ctx context.Context, bucketName, objectKey, digest 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) // IsObjectExist returns whether the object exists. IsObjectExist(ctx context.Context, bucketName, objectKey string) (bool, error) // GetSignURL returns sign url of object. GetSignURL(ctx context.Context, bucketName, objectKey string, method Method, expire time.Duration) (string, 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.