storage

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0, Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectOptions

type ConnectOptions struct {
	Context          context.Context
	S3Region         string
	S3Endpoint       string
	UnsignedRequests bool
	GCSEndpoint      string

	// When putting file object to s3 bucket, specify the ACL for the object.
	S3WriteACL string

	// UserAgent is the value of `User-Agent` header. Applicable only for HTTP
	// client.
	UserAgent string
}

type Filesystem

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

func (*Filesystem) CanListFiles

func (b *Filesystem) CanListFiles() bool

func (*Filesystem) Close

func (b *Filesystem) Close() error

func (*Filesystem) Exists

func (b *Filesystem) Exists(pth string) (bool, error)

func (*Filesystem) GetFile

func (b *Filesystem) GetFile(pth string) (io.ReadCloser, error)

func (*Filesystem) ListFiles

func (b *Filesystem) ListFiles(pth string) (chan string, chan error)

func (*Filesystem) PutFile

func (b *Filesystem) PutFile(pth string, in io.ReadCloser) error

func (*Filesystem) Size

func (b *Filesystem) Size(pth string) (int64, error)

type GCSStorage

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

func (*GCSStorage) CanListFiles

func (b *GCSStorage) CanListFiles() bool

func (*GCSStorage) Close

func (b *GCSStorage) Close() error

func (*GCSStorage) Exists

func (b *GCSStorage) Exists(pth string) (bool, error)

func (*GCSStorage) GetFile

func (b *GCSStorage) GetFile(pth string) (io.ReadCloser, error)

func (*GCSStorage) ListFiles

func (b *GCSStorage) ListFiles(pth string) (chan string, chan error)

func (*GCSStorage) PutFile

func (b *GCSStorage) PutFile(pth string, in io.ReadCloser) error

func (*GCSStorage) Size

func (b *GCSStorage) Size(pth string) (int64, error)

type HttpStorage

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

func (*HttpStorage) CanListFiles

func (b *HttpStorage) CanListFiles() bool

func (*HttpStorage) Close

func (b *HttpStorage) Close() error

func (*HttpStorage) Exists

func (b *HttpStorage) Exists(pth string) (bool, error)

func (*HttpStorage) GetFile

func (b *HttpStorage) GetFile(pth string) (io.ReadCloser, error)

func (*HttpStorage) Head

func (b *HttpStorage) Head(pth string) (*http.Response, error)

func (*HttpStorage) ListFiles

func (b *HttpStorage) ListFiles(pth string) (chan string, chan error)

func (*HttpStorage) PutFile

func (b *HttpStorage) PutFile(pth string, in io.ReadCloser) error

func (*HttpStorage) Size

func (b *HttpStorage) Size(pth string) (int64, error)

type S3Storage

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

func (*S3Storage) CanListFiles

func (b *S3Storage) CanListFiles() bool

func (*S3Storage) Close

func (b *S3Storage) Close() error

func (*S3Storage) Exists

func (b *S3Storage) Exists(pth string) (bool, error)

func (*S3Storage) GetACLWriteRule

func (b *S3Storage) GetACLWriteRule() string

func (*S3Storage) GetFile

func (b *S3Storage) GetFile(pth string) (io.ReadCloser, error)

func (*S3Storage) Head

func (b *S3Storage) Head(pth string) (*http.Response, error)

func (*S3Storage) ListFiles

func (b *S3Storage) ListFiles(pth string) (chan string, chan error)

func (*S3Storage) PutFile

func (b *S3Storage) PutFile(pth string, in io.ReadCloser) error

func (*S3Storage) Size

func (b *S3Storage) Size(pth string) (int64, error)

type Storage

type Storage interface {
	Exists(path string) (bool, error)
	Size(path string) (int64, error)
	GetFile(path string) (io.ReadCloser, error)
	PutFile(path string, in io.ReadCloser) error
	ListFiles(path string) (chan string, chan error)
	CanListFiles() bool
	Close() error
}

func ConnectBackend

func ConnectBackend(u string, opts ConnectOptions) (Storage, error)

func NewFilesystemStorage

func NewFilesystemStorage(pth string) Storage

func NewGCSBackend

func NewGCSBackend(
	ctx context.Context,
	bucketName string,
	prefix string,
	endpoint string,
) (Storage, error)

func NewHttpStorage

func NewHttpStorage(ctx context.Context, base *url.URL, userAgent string) Storage

func NewS3Storage

func NewS3Storage(
	ctx context.Context,
	bucket string,
	prefix string,
	region string,
	endpoint string,
	unsignedRequests bool,
	writeACLrule string,
) (Storage, error)

Jump to

Keyboard shortcuts

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