Documentation
¶
Overview ¶
Package storage provides a portable storage bucket API with cross-cutting concerns.
Index ¶
- type Bucket
- func (b *Bucket) AbortMultipartUpload(ctx context.Context, bucket, key, uploadID string) error
- func (b *Bucket) CompleteMultipartUpload(ctx context.Context, bucket, key, uploadID string, parts []driver.UploadPart) error
- func (b *Bucket) CopyObject(ctx context.Context, dstBucket, dstKey string, src driver.CopySource) error
- func (b *Bucket) CreateBucket(ctx context.Context, name string) error
- func (b *Bucket) CreateMultipartUpload(ctx context.Context, bucket, key, contentType string) (*driver.MultipartUpload, error)
- func (b *Bucket) DeleteBucket(ctx context.Context, name string) error
- func (b *Bucket) DeleteObject(ctx context.Context, bucket, key string) error
- func (b *Bucket) EvaluateLifecycle(ctx context.Context, bucket string) ([]string, error)
- func (b *Bucket) GeneratePresignedURL(ctx context.Context, req driver.PresignedURLRequest) (*driver.PresignedURL, error)
- func (b *Bucket) GetBucketVersioning(ctx context.Context, bucket string) (bool, error)
- func (b *Bucket) GetLifecycleConfig(ctx context.Context, bucket string) (*driver.LifecycleConfig, error)
- func (b *Bucket) GetObject(ctx context.Context, bucket, key string) (*driver.Object, error)
- func (b *Bucket) HeadObject(ctx context.Context, bucket, key string) (*driver.ObjectInfo, error)
- func (b *Bucket) ListBuckets(ctx context.Context) ([]driver.BucketInfo, error)
- func (b *Bucket) ListMultipartUploads(ctx context.Context, bucket string) ([]driver.MultipartUpload, error)
- func (b *Bucket) ListObjects(ctx context.Context, bucket string, opts driver.ListOptions) (*driver.ListResult, error)
- func (b *Bucket) PutLifecycleConfig(ctx context.Context, bucket string, config driver.LifecycleConfig) error
- func (b *Bucket) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, ...) error
- func (b *Bucket) SetBucketVersioning(ctx context.Context, bucket string, enabled bool) error
- func (b *Bucket) UploadPart(ctx context.Context, bucket, key, uploadID string, partNumber int, data []byte) (*driver.UploadPart, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is the portable storage type wrapping a driver with cross-cutting concerns.
func (*Bucket) AbortMultipartUpload ¶ added in v1.2.0
AbortMultipartUpload aborts a multipart upload and removes all uploaded parts.
func (*Bucket) CompleteMultipartUpload ¶ added in v1.2.0
func (b *Bucket) CompleteMultipartUpload( ctx context.Context, bucket, key, uploadID string, parts []driver.UploadPart, ) error
CompleteMultipartUpload completes a multipart upload by assembling all parts.
func (*Bucket) CopyObject ¶
func (b *Bucket) CopyObject(ctx context.Context, dstBucket, dstKey string, src driver.CopySource) error
CopyObject copies an object between buckets.
func (*Bucket) CreateBucket ¶
CreateBucket creates a new storage bucket.
func (*Bucket) CreateMultipartUpload ¶ added in v1.2.0
func (b *Bucket) CreateMultipartUpload( ctx context.Context, bucket, key, contentType string, ) (*driver.MultipartUpload, error)
CreateMultipartUpload initiates a multipart upload.
func (*Bucket) DeleteBucket ¶
DeleteBucket deletes a storage bucket.
func (*Bucket) DeleteObject ¶
DeleteObject deletes an object from a bucket.
func (*Bucket) EvaluateLifecycle ¶ added in v1.2.0
EvaluateLifecycle evaluates lifecycle rules and returns keys eligible for expiration.
func (*Bucket) GeneratePresignedURL ¶ added in v1.2.0
func (b *Bucket) GeneratePresignedURL(ctx context.Context, req driver.PresignedURLRequest) (*driver.PresignedURL, error)
GeneratePresignedURL generates a presigned URL for an object.
func (*Bucket) GetBucketVersioning ¶ added in v1.2.0
GetBucketVersioning returns whether versioning is enabled on a bucket.
func (*Bucket) GetLifecycleConfig ¶ added in v1.2.0
func (b *Bucket) GetLifecycleConfig(ctx context.Context, bucket string) (*driver.LifecycleConfig, error)
GetLifecycleConfig retrieves the lifecycle configuration for a bucket.
func (*Bucket) HeadObject ¶
HeadObject retrieves object metadata without the body.
func (*Bucket) ListBuckets ¶
ListBuckets lists all buckets.
func (*Bucket) ListMultipartUploads ¶ added in v1.2.0
func (b *Bucket) ListMultipartUploads(ctx context.Context, bucket string) ([]driver.MultipartUpload, error)
ListMultipartUploads lists active multipart uploads for a bucket.
func (*Bucket) ListObjects ¶
func (b *Bucket) ListObjects(ctx context.Context, bucket string, opts driver.ListOptions) (*driver.ListResult, error)
ListObjects lists objects in a bucket.
func (*Bucket) PutLifecycleConfig ¶ added in v1.2.0
func (b *Bucket) PutLifecycleConfig(ctx context.Context, bucket string, config driver.LifecycleConfig) error
PutLifecycleConfig sets a lifecycle configuration on a bucket.
func (*Bucket) PutObject ¶
func (b *Bucket) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, metadata map[string]string) error
PutObject stores an object in a bucket.
func (*Bucket) SetBucketVersioning ¶ added in v1.2.0
SetBucketVersioning enables or disables versioning on a bucket.
type Option ¶
type Option func(*Bucket)
Option configures a portable Bucket.
func WithErrorInjection ¶
WithErrorInjection sets the error injector.
func WithMetrics ¶
WithMetrics sets the metrics collector.
func WithRateLimiter ¶
WithRateLimiter sets the rate limiter.