storage

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const B2Schema = "b2://"
View Source
const GCSSchema = "gs://"
View Source
const S3Schema = "s3://"

Variables

View Source
var ErrUnknownPrefix = errors.New("unknown prefix")

Functions

func CompleteBuckets added in v1.18.0

func CompleteBuckets(u *url.URL) ([]string, cobra.ShellCompDirective)

func CompleteObjects added in v1.18.0

func CompleteObjects(u *url.URL, exts []string, dirOnly bool) ([]string, cobra.ShellCompDirective)

func IsB2 added in v1.18.0

func IsB2(path string) bool

func IsB2Dir added in v1.18.0

func IsB2Dir(path string) bool

func IsCloud

func IsCloud(path string) bool

func IsCloudDir

func IsCloudDir(path string) bool

func IsGCS

func IsGCS(path string) bool

func IsGCSDir

func IsGCSDir(path string) bool

func IsS3

func IsS3(path string) bool

func IsS3Dir

func IsS3Dir(path string) bool

Types

type B2 added in v1.18.0

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

func NewB2 added in v1.18.0

func NewB2(ctx context.Context) (*B2, error)

func (*B2) GetObject added in v1.18.0

func (b *B2) GetObject(ctx context.Context, key string) (io.ReadCloser, error)

func (*B2) ListBuckets added in v1.18.0

func (b *B2) ListBuckets(ctx context.Context) iter.Seq2[*Bucket, error]

func (*B2) ListObjects added in v1.18.0

func (b *B2) ListObjects(ctx context.Context, key string) iter.Seq2[*Object, error]

func (*B2) PutObject added in v1.18.0

func (b *B2) PutObject(ctx context.Context, r io.Reader, key string) error

type Bucket added in v1.18.0

type Bucket struct {
	Name string
}

type Client added in v1.18.0

type Client interface {
	ListBuckets(ctx context.Context) iter.Seq2[*Bucket, error]
	ListObjects(ctx context.Context, key string) iter.Seq2[*Object, error]
	PutObject(ctx context.Context, r io.Reader, key string) error
	GetObject(ctx context.Context, key string) (io.ReadCloser, error)
}

func NewClient added in v1.18.0

func NewClient(ctx context.Context, path string) (Client, error)

type GCS added in v1.18.0

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

func NewGCS added in v1.18.0

func NewGCS(ctx context.Context, scope, projectID string) (*GCS, error)

func (*GCS) GetObject added in v1.18.0

func (g *GCS) GetObject(ctx context.Context, key string) (io.ReadCloser, error)

func (*GCS) ListBuckets added in v1.18.0

func (g *GCS) ListBuckets(ctx context.Context) iter.Seq2[*Bucket, error]

func (*GCS) ListObjects added in v1.18.0

func (g *GCS) ListObjects(ctx context.Context, key string) iter.Seq2[*Object, error]

func (*GCS) PutObject added in v1.18.0

func (g *GCS) PutObject(ctx context.Context, r io.Reader, key string) error

type Object added in v1.18.0

type Object struct {
	Name         string
	IsDir        bool
	LastModified time.Time
	Size         int64
}

type S3 added in v1.18.0

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

func NewS3 added in v1.18.0

func NewS3(ctx context.Context) (*S3, error)

func (*S3) GetObject added in v1.18.0

func (s *S3) GetObject(ctx context.Context, key string) (io.ReadCloser, error)

func (*S3) ListBuckets added in v1.18.0

func (s *S3) ListBuckets(ctx context.Context) iter.Seq2[*Bucket, error]

func (*S3) ListObjects added in v1.18.0

func (s *S3) ListObjects(ctx context.Context, key string) iter.Seq2[*Object, error]

func (*S3) PutObject added in v1.18.0

func (s *S3) PutObject(ctx context.Context, r io.Reader, key string) error

Jump to

Keyboard shortcuts

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