storage

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 ContinuationToken

type ContinuationToken string

Type aliases for clarity

type Delimiter

type Delimiter string

Type aliases for clarity

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 Marker

type Marker string

Type aliases for clarity

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 Prefix

type Prefix string

Type aliases for clarity

type Storage

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

Storage handles filesystem operations for buckets and objects

func New

func New(rootFS billy.Filesystem, metadataManager *metadata.Manager) (*Storage, error)

New creates a new storage backend

func (*Storage) BucketExists

func (s *Storage) BucketExists(ctx context.Context, bucket string) (bool, error)

BucketExists checks if a bucket exists

func (*Storage) CleanupMultipartUpload

func (s *Storage) CleanupMultipartUpload(ctx context.Context, bucket, uploadID string) error

CleanupMultipartUpload removes all staging state for a multipart uploadID.

func (*Storage) CreateBucket

func (s *Storage) CreateBucket(ctx context.Context, bucket string) error

CreateBucket creates a new bucket

func (*Storage) DeleteBucket

func (s *Storage) DeleteBucket(ctx context.Context, bucket string) error

DeleteBucket deletes a bucket (must be empty)

func (*Storage) DeleteObject

func (s *Storage) DeleteObject(ctx context.Context, bucket, key string) error

DeleteObject removes an object

func (*Storage) GetBucketFS

func (s *Storage) GetBucketFS(ctx context.Context, bucket string) (billy.Filesystem, error)

GetBucketFS returns a billy.Filesystem for the specified bucket

func (*Storage) GetObject

func (s *Storage) GetObject(ctx context.Context, bucket, key string) (*Object, error)

GetObject retrieves an object from storage

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

func (s *Storage) GetUploadStagingFS(ctx context.Context, bucket string) (billy.Filesystem, error)

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

func (s *Storage) ListBuckets(ctx context.Context) ([]s3types.Bucket, error)

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.

func (*Storage) PutObject

func (s *Storage) PutObject(ctx context.Context, bucket, key string, content io.Reader, contentType string, customMetadata map[string]string) (string, error)

PutObject stores an object

Jump to

Keyboard shortcuts

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