anyfs

package
v0.0.0-...-9db4733 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = fmt.Errorf("not found")

Functions

This section is empty.

Types

type FS

type FS interface {
	Put(ctx context.Context, path string, body io.Reader, metadata map[string]string) error
	GetReader(ctx context.Context, path string) (io.ReadCloser, *FileInfo, error)
	GetBytes(ctx context.Context, path string) ([]byte, error)
	Head(ctx context.Context, path string) (*FileInfo, error)
	List(ctx context.Context, path string) ([]ListInfo, error)

	Join(path ...string) string
}

func NewEnvFS

func NewEnvFS(ctx context.Context, name string) (FS, error)

NewEnvFS creates a new FS that will configure the client as needed from env vars.

type FileInfo

type FileInfo struct {
	Metadata map[string]string
	Size     int64
}

type ListInfo

type ListInfo struct {
	Name string
	Size int64
}

type LocalFS

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

func NewLocalFS

func NewLocalFS(root string) (*LocalFS, error)

func (*LocalFS) GetBytes

func (local *LocalFS) GetBytes(ctx context.Context, subPath string) ([]byte, error)

func (*LocalFS) GetReader

func (local *LocalFS) GetReader(ctx context.Context, subPath string) (io.ReadCloser, *FileInfo, error)

func (*LocalFS) Head

func (local *LocalFS) Head(ctx context.Context, subPath string) (*FileInfo, error)

func (LocalFS) Join

func (LocalFS) Join(paths ...string) string

func (*LocalFS) List

func (local *LocalFS) List(ctx context.Context, subPath string) ([]ListInfo, error)

func (*LocalFS) Put

func (local *LocalFS) Put(ctx context.Context, subPath string, body io.Reader, metadata map[string]string) error

type S3API

type S3API interface {
	GetObject(ctx context.Context, input *s3.GetObjectInput, options ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	PutObject(ctx context.Context, input *s3.PutObjectInput, options ...func(*s3.Options)) (*s3.PutObjectOutput, error)
	HeadObject(ctx context.Context, input *s3.HeadObjectInput, options ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
	ListObjectsV2(ctx context.Context, input *s3.ListObjectsV2Input, options ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
}

type S3FS

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

func NewS3EnvFS

func NewS3EnvFS(ctx context.Context, location string) (*S3FS, error)

func NewS3FS

func NewS3FS(client S3API, location string) (*S3FS, error)

func (*S3FS) GetBytes

func (s3fs *S3FS) GetBytes(ctx context.Context, subPath string) ([]byte, error)

func (*S3FS) GetReader

func (s3fs *S3FS) GetReader(ctx context.Context, subPath string) (io.ReadCloser, *FileInfo, error)

func (*S3FS) Head

func (s3fs *S3FS) Head(ctx context.Context, subPath string) (*FileInfo, error)

func (*S3FS) Join

func (s3fs *S3FS) Join(paths ...string) string

func (*S3FS) List

func (s3fs *S3FS) List(ctx context.Context, subPath string) ([]ListInfo, error)

func (*S3FS) Put

func (s3fs *S3FS) Put(ctx context.Context, subPath string, body io.Reader, metadata map[string]string) error

type TempFS

type TempFS struct {
	*LocalFS
}

func NewTempFS

func NewTempFS(ctx context.Context) (*TempFS, error)

Jump to

Keyboard shortcuts

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