cloudstorage

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// DownloadObject downloads an object from cloud storage to a local file
	// Returns the temp filename, size, whether object was not found, and error
	DownloadObject(ctx context.Context, tmpdir, bucket, key string) (filename string, size int64, notFound bool, err error)

	// UploadObject uploads a local file to cloud storage
	UploadObject(ctx context.Context, bucket, key, sourceFilename string) error

	// DeleteObject deletes an object from cloud storage
	DeleteObject(ctx context.Context, bucket, key string) error

	// DeleteObjects deletes multiple objects from cloud storage in a single batch operation
	// Returns any keys that failed to delete and any error encountered
	DeleteObjects(ctx context.Context, bucket string, keys []string) (failed []string, err error)
}

Client provides a unified interface for cloud storage operations across different providers

func NewClient

func NewClient(ctx context.Context, provider ClientProvider, profile storageprofile.StorageProfile) (Client, error)

NewClient delegates client creation to the provided ClientProvider. It is a convenience wrapper to preserve existing call sites that expect a package level function.

type ClientProvider

type ClientProvider interface {
	NewClient(ctx context.Context, profile storageprofile.StorageProfile) (Client, error)
}

ClientProvider creates cloud storage clients based on a storage profile. Implementations may target real cloud providers or local filesystem mocks used for testing.

func NewCloudManagers

func NewCloudManagers(ctx context.Context) (ClientProvider, error)

NewCloudManagers creates managers for all supported cloud providers

func NewFileClientProvider

func NewFileClientProvider(base string) ClientProvider

NewFileClientProvider returns a new provider rooted at base.

type CloudManagers

type CloudManagers struct {
	AWS   *awsclient.Manager
	Azure *azureclient.Manager
	GCP   *gcpclient.Manager
}

CloudManagers holds all cloud provider managers for unified access. It implements ClientProvider to allow callers to create storage clients without depending on the concrete struct, enabling easier testing.

func (*CloudManagers) NewClient

func (m *CloudManagers) NewClient(ctx context.Context, profile storageprofile.StorageProfile) (Client, error)

NewClient creates a storage Client for the given profile.

type FileClientProvider

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

FileClientProvider creates clients that operate on the local filesystem. It is intended for tests that want to bypass real cloud providers.

func (*FileClientProvider) NewClient

NewClient returns a client that reads and writes files under the base path.

Jump to

Keyboard shortcuts

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