Documentation
¶
Index ¶
- Variables
- type ContinuationToken
- type Delimiter
- type InternalResult
- type Marker
- type Object
- type ObjectContent
- type Prefix
- type Storage
- func (s *Storage) BucketExists(ctx context.Context, bucket string) (bool, error)
- func (s *Storage) CleanupMultipartUpload(ctx context.Context, bucket, uploadID string) error
- func (s *Storage) CreateBucket(ctx context.Context, bucket string) error
- func (s *Storage) DeleteBucket(ctx context.Context, bucket string) error
- func (s *Storage) DeleteObject(ctx context.Context, bucket, key string) error
- func (s *Storage) GetBucketFS(ctx context.Context, bucket string) (billy.Filesystem, error)
- func (s *Storage) GetObject(ctx context.Context, bucket, key string) (*Object, error)
- func (s *Storage) GetObjectMetadata(ctx context.Context, bucket, key string) (*metadata.ObjectMetadata, error)
- func (s *Storage) GetUploadStagingFS(ctx context.Context, bucket string) (billy.Filesystem, error)
- func (s *Storage) ListBuckets(ctx context.Context) ([]s3types.Bucket, error)
- func (s *Storage) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (InternalResult, error)
- func (s *Storage) ListObjectsV2(ctx context.Context, ...) (InternalResult, error)
- func (s *Storage) PutObject(ctx context.Context, bucket, key string, content io.Reader, contentType string, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrBucketExists = s3types.ErrBucketAlreadyExists ErrNoSuchBucket = s3types.ErrBucketNotFound ErrBucketNotEmpty = s3types.ErrBucketNotEmpty ErrNoSuchKey = s3types.ErrObjectNotFound )
Use s3types errors for consistency across all layers
Functions ¶
This section is empty.
Types ¶
type InternalResult ¶
type InternalResult struct {
Objects []s3types.Object
CommonPrefixes []s3types.CommonPrefix
IsTruncated bool
NextMarker string // Use this as NextMarker (V1) or NextContinuationToken (V2)
}
InternalResult contains the unified listing result used by both V1 and V2
type Object ¶
type Object struct {
Key string
Size int64
ContentType string
ETag string
LastModified time.Time
Content ObjectContent
CustomMetadata map[string]string // Custom headers like Cache-Control, Content-Disposition, x-amz-meta-*, etc.
}
Object represents an S3 object with content
type ObjectContent ¶
type ObjectContent interface {
io.ReadCloser
io.ReaderAt
}
ObjectContent is the interface for readable object content. It supports both sequential reads and random-access reads (required for range requests).
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage handles filesystem operations for buckets and objects
func (*Storage) BucketExists ¶
BucketExists checks if a bucket exists
func (*Storage) CleanupMultipartUpload ¶
CleanupMultipartUpload removes all staging state for a multipart uploadID.
func (*Storage) CreateBucket ¶
CreateBucket creates a new bucket
func (*Storage) DeleteBucket ¶
DeleteBucket deletes a bucket (must be empty)
func (*Storage) DeleteObject ¶
DeleteObject removes an object
func (*Storage) GetBucketFS ¶
GetBucketFS returns a billy.Filesystem for the specified bucket
func (*Storage) GetObjectMetadata ¶
func (s *Storage) GetObjectMetadata(ctx context.Context, bucket, key string) (*metadata.ObjectMetadata, error)
GetObjectMetadata retrieves metadataManager for an object
func (*Storage) GetUploadStagingFS ¶
GetUploadStagingFS returns a billy.Filesystem scoped to the upload staging area for a bucket. All in-progress write state lives here, outside bucket directories.
func (*Storage) ListBuckets ¶
ListBuckets returns all buckets
func (*Storage) ListObjects ¶
func (s *Storage) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (InternalResult, error)
ListObjects returns objects in a bucket with optional prefix, marker, and delimiter (V1 API)
func (*Storage) ListObjectsV2 ¶
func (s *Storage) ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, startAfter, delimiter string, maxKeys int, fetchOwner bool) (InternalResult, error)
ListObjectsV2 returns objects in a bucket with optional prefix and delimiter (V2 API) The fetchOwner parameter determines whether to include owner information in each object. Per S3 spec, owner is NOT included by default - set fetchOwner=true to include it.