blob

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureStore

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

AzureStore implements BlobStore for Azure Blob Storage.

func NewAzureStore

func NewAzureStore(config types.AzureConfig) (*AzureStore, error)

NewAzureStore creates a new Azure blob store.

func (*AzureStore) Delete

func (a *AzureStore) Delete(ctx context.Context, bucket, key string) error

func (*AzureStore) Download

func (a *AzureStore) Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)

func (*AzureStore) Test

func (a *AzureStore) Test(ctx context.Context) error

func (*AzureStore) Upload

func (a *AzureStore) Upload(ctx context.Context, bucket, key string, data io.Reader) error

type BlobStore

type BlobStore interface {
	// Upload writes data to the given bucket and key.
	Upload(ctx context.Context, bucket, key string, data io.Reader) error

	// Download retrieves the object at the given bucket and key.
	// The caller is responsible for closing the returned ReadCloser.
	Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)

	// Delete removes the object at the given bucket and key.
	Delete(ctx context.Context, bucket, key string) error

	// Test verifies that the store is configured correctly and reachable.
	Test(ctx context.Context) error
}

BlobStore provides a unified interface for cloud object storage operations. nolint:revive

func New

func New(providerType types.StorageProviderType, config types.StorageConfig) (BlobStore, error)

New creates a BlobStore for the given provider type and config.

type CustomS3Store

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

CustomS3Store implements BlobStore for S3-compatible storage (MinIO, R2, etc.).

func NewCustomS3Store

func NewCustomS3Store(config types.CustomS3Config) (*CustomS3Store, error)

NewCustomS3Store creates a new custom S3 blob store.

func (*CustomS3Store) Delete

func (c *CustomS3Store) Delete(ctx context.Context, bucket, key string) error

func (*CustomS3Store) Download

func (c *CustomS3Store) Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)

func (*CustomS3Store) Test

Test is a no-op for custom S3 storage as there is no standard way to test it.

func (*CustomS3Store) Upload

func (c *CustomS3Store) Upload(ctx context.Context, bucket, key string, data io.Reader) error

type DirectoryStore

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

DirectoryStore implements BlobStore using the local filesystem. Objects are stored at <baseDir>/<bucket>/<key>.

func NewDirectoryStore

func NewDirectoryStore(baseDir string) (*DirectoryStore, error)

NewDirectoryStore creates a new DirectoryStore rooted at baseDir. The directory is created if it does not exist.

func (*DirectoryStore) Delete

func (d *DirectoryStore) Delete(_ context.Context, bucket, key string) error

func (*DirectoryStore) Download

func (d *DirectoryStore) Download(_ context.Context, bucket, key string) (io.ReadCloser, error)

func (*DirectoryStore) Test

func (d *DirectoryStore) Test(_ context.Context) error

func (*DirectoryStore) Upload

func (d *DirectoryStore) Upload(_ context.Context, bucket, key string, data io.Reader) error

type GCSStore

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

GCSStore implements BlobStore for Google Cloud Storage.

func NewGCSStore

func NewGCSStore(config types.GCSConfig) (*GCSStore, error)

NewGCSStore creates a new GCS blob store.

func (*GCSStore) Delete

func (g *GCSStore) Delete(ctx context.Context, bucket, key string) error

func (*GCSStore) Download

func (g *GCSStore) Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)

func (*GCSStore) Test

func (g *GCSStore) Test(ctx context.Context) error

func (*GCSStore) Upload

func (g *GCSStore) Upload(ctx context.Context, bucket, key string, data io.Reader) error

type S3Store

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

S3Store implements BlobStore for Amazon S3.

func NewS3Store

func NewS3Store(config types.S3Config) (*S3Store, error)

NewS3Store creates a new S3 blob store.

func (*S3Store) Delete

func (s *S3Store) Delete(ctx context.Context, bucket, key string) error

func (*S3Store) Download

func (s *S3Store) Download(ctx context.Context, bucket, key string) (io.ReadCloser, error)

func (*S3Store) Test

func (s *S3Store) Test(ctx context.Context) error

func (*S3Store) Upload

func (s *S3Store) Upload(ctx context.Context, bucket, key string, data io.Reader) error

Jump to

Keyboard shortcuts

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