storage

package
v0.0.0-...-51d4900 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureBackend

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

AzureBackend implements the Backend interface using Azure Blob Storage AzureBackend implements the Backend interface using Azure Blob Storage

func NewAzureBackend

func NewAzureBackend(config AzureConfig) (*AzureBackend, error)

NewAzureBackend creates a new Azure Blob Storage backend

func (*AzureBackend) Delete

func (a *AzureBackend) Delete(ctx context.Context, path string) error

Delete deletes a file from Azure Blob Storage

func (*AzureBackend) Download

func (a *AzureBackend) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download downloads a file from Azure Blob Storage

func (*AzureBackend) Exists

func (a *AzureBackend) Exists(ctx context.Context, path string) (bool, error)

Exists checks if a file exists in Azure Blob Storage

func (*AzureBackend) GetLastModified

func (a *AzureBackend) GetLastModified(ctx context.Context, path string) (time.Time, error)

GetLastModified returns the last modified time of a file

func (*AzureBackend) GetSize

func (a *AzureBackend) GetSize(ctx context.Context, path string) (int64, error)

GetSize returns the size of a file in bytes

func (*AzureBackend) GetURL

func (a *AzureBackend) GetURL(ctx context.Context, path string, expiry time.Duration) (string, error)

GetURL returns a presigned URL for downloading

func (*AzureBackend) List

func (a *AzureBackend) List(ctx context.Context, prefix string) ([]string, error)

List lists files with the given prefix

func (*AzureBackend) Upload

func (a *AzureBackend) Upload(ctx context.Context, path string, reader io.Reader, size int64) error

Upload uploads a file to Azure Blob Storage

type AzureConfig

type AzureConfig struct {
	AccountName   string
	AccountKey    string
	ContainerName string
	EndpointURL   string
}

type Backend

type Backend interface {
	// Upload uploads a file to the storage backend
	Upload(ctx context.Context, path string, reader io.Reader, size int64) error

	// Download downloads a file from the storage backend
	Download(ctx context.Context, path string) (io.ReadCloser, error)

	// Delete deletes a file from the storage backend
	Delete(ctx context.Context, path string) error

	// Exists checks if a file exists in the storage backend
	Exists(ctx context.Context, path string) (bool, error)

	// GetSize returns the size of a file in bytes
	GetSize(ctx context.Context, path string) (int64, error)

	// GetLastModified returns the last modified time of a file
	GetLastModified(ctx context.Context, path string) (time.Time, error)

	// List lists files with the given prefix
	List(ctx context.Context, prefix string) ([]string, error)

	// GetURL returns a presigned URL for downloading (if supported)
	GetURL(ctx context.Context, path string, expiry time.Duration) (string, error)
}

Backend defines the interface for artifact storage backends

func NewBackend

func NewBackend(config Config) (Backend, error)

NewBackend creates a new storage backend based on the configuration

type Config

type Config struct {
	Backend    string
	Azure      AzureConfig
	S3         S3Config
	Filesystem FilesystemConfig
}

Config holds the configuration for storage backends

type FilesystemBackend

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

FilesystemBackend implements the Backend interface using local filesystem

func NewFilesystemBackend

func NewFilesystemBackend(config FilesystemConfig) (*FilesystemBackend, error)

NewFilesystemBackend creates a new filesystem storage backend

func (*FilesystemBackend) Delete

func (f *FilesystemBackend) Delete(ctx context.Context, path string) error

Delete deletes a file from the filesystem

func (*FilesystemBackend) Download

func (f *FilesystemBackend) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download downloads a file from the filesystem

func (*FilesystemBackend) Exists

func (f *FilesystemBackend) Exists(ctx context.Context, path string) (bool, error)

Exists checks if a file exists in the filesystem

func (*FilesystemBackend) GetLastModified

func (f *FilesystemBackend) GetLastModified(ctx context.Context, path string) (time.Time, error)

GetLastModified returns the last modified time of a file

func (*FilesystemBackend) GetSize

func (f *FilesystemBackend) GetSize(ctx context.Context, path string) (int64, error)

GetSize returns the size of a file in bytes

func (*FilesystemBackend) GetURL

func (f *FilesystemBackend) GetURL(ctx context.Context, path string, expiry time.Duration) (string, error)

GetURL returns a presigned URL for downloading (not supported for filesystem)

func (*FilesystemBackend) List

func (f *FilesystemBackend) List(ctx context.Context, prefix string) ([]string, error)

List lists files with the given prefix

func (*FilesystemBackend) Upload

func (f *FilesystemBackend) Upload(ctx context.Context, path string, reader io.Reader, size int64) error

Upload uploads a file to the filesystem

type FilesystemConfig

type FilesystemConfig struct {
	BasePath string
}

type S3Backend

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

S3Backend implements the Backend interface using S3-compatible storage

func NewS3Backend

func NewS3Backend(config S3Config) (*S3Backend, error)

NewS3Backend creates a new S3-compatible storage backend

func (*S3Backend) Delete

func (s *S3Backend) Delete(ctx context.Context, path string) error

Delete deletes a file from S3-compatible storage

func (*S3Backend) Download

func (s *S3Backend) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download downloads a file from S3-compatible storage

func (*S3Backend) Exists

func (s *S3Backend) Exists(ctx context.Context, path string) (bool, error)

Exists checks if a file exists in S3-compatible storage

func (*S3Backend) GetLastModified

func (s *S3Backend) GetLastModified(ctx context.Context, path string) (time.Time, error)

GetLastModified returns the last modified time of a file

func (*S3Backend) GetSize

func (s *S3Backend) GetSize(ctx context.Context, path string) (int64, error)

GetSize returns the size of a file in bytes

func (*S3Backend) GetURL

func (s *S3Backend) GetURL(ctx context.Context, path string, expiry time.Duration) (string, error)

GetURL returns a presigned URL for downloading

func (*S3Backend) List

func (s *S3Backend) List(ctx context.Context, prefix string) ([]string, error)

List lists files with the given prefix

func (*S3Backend) Upload

func (s *S3Backend) Upload(ctx context.Context, path string, reader io.Reader, size int64) error

Upload uploads a file to S3-compatible storage

type S3Config

type S3Config struct {
	Region          string
	Bucket          string
	AccessKeyID     string
	SecretAccessKey string
	EndpointURL     string
	UseSSL          bool
}

Jump to

Keyboard shortcuts

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