storage

package
v0.0.0-...-ff642e8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObjectNotFound = xerrors.New("storage: object not found")
)

Functions

This section is empty.

Types

type GCSOptions

type GCSOptions struct {
	Retries int
}

type Google

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

func NewGCS

func NewGCS(creds []byte, bucket string, opt GCSOptions) *Google

func (*Google) Delete

func (g *Google) Delete(ctx context.Context, key string) error

func (*Google) Get

func (g *Google) Get(ctx context.Context, name string) (*Object, error)

func (*Google) List

func (g *Google) List(ctx context.Context, prefix string) ([]*Object, error)

func (*Google) Name

func (g *Google) Name() string

func (*Google) Put

func (g *Google) Put(ctx context.Context, name string, data []byte) error

func (*Google) PutReader

func (g *Google) PutReader(ctx context.Context, name string, data io.Reader) error

type MinIO

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

func NewMinIOStorage

func NewMinIOStorage(bucket string, opt MinIOOptions) *MinIO

NewMinIOStorage returns the client for MinIO Deprecated: Use the client for S3 instead. The SDK of MinIO is not good quality.

func (*MinIO) Close

func (m *MinIO) Close()

func (*MinIO) Delete

func (m *MinIO) Delete(ctx context.Context, name string) error

func (*MinIO) Get

func (m *MinIO) Get(ctx context.Context, name string) (*Object, error)

func (*MinIO) List

func (m *MinIO) List(ctx context.Context, prefix string) ([]*Object, error)

func (*MinIO) ListRecursive

func (m *MinIO) ListRecursive(ctx context.Context, prefix string, recursive bool) ([]minio.ObjectInfo, error)

func (*MinIO) Name

func (m *MinIO) Name() string

func (*MinIO) Put

func (m *MinIO) Put(ctx context.Context, name string, data []byte) error

func (*MinIO) PutReader

func (m *MinIO) PutReader(ctx context.Context, name string, r io.Reader) error

type MinIOOptions

type MinIOOptions struct {
	Name            string
	Namespace       string
	Endpoint        string
	Region          string
	Port            int
	AccessKey       string
	SecretAccessKey string
	Retries         int

	Dev bool

	// PodLister is an optional value.
	PodLister corev1listers.PodLister
	// ServiceLister is an optional value.
	ServiceLister corev1listers.ServiceLister
	// Transport is an optional value.
	Transport http.RoundTripper
	// contains filtered or unexported fields
}

func NewMinIOOptionsViaEndpoint

func NewMinIOOptionsViaEndpoint(endpoint, region, accessKey, secretAccessKey string) MinIOOptions

func NewMinIOOptionsViaService

func NewMinIOOptionsViaService(
	client kubernetes.Interface,
	config *rest.Config,
	name, namespace string,
	port int,
	accessKey, secretAccessKey string,
	dev bool,
) MinIOOptions

func (*MinIOOptions) Client

func (m *MinIOOptions) Client(ctx context.Context) (*minio.Client, error)

func (*MinIOOptions) Close

func (m *MinIOOptions) Close()

type Mock

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

func NewMock

func NewMock() *Mock

func (*Mock) AddTree

func (m *Mock) AddTree(name string, data []byte)

func (*Mock) Delete

func (m *Mock) Delete(_ context.Context, name string) error

func (*Mock) Get

func (m *Mock) Get(_ context.Context, name string) (*Object, error)

func (*Mock) List

func (m *Mock) List(_ context.Context, prefix string) ([]*Object, error)

func (*Mock) Name

func (m *Mock) Name() string

func (*Mock) Put

func (m *Mock) Put(_ context.Context, name string, data []byte) error

func (*Mock) PutReader

func (m *Mock) PutReader(ctx context.Context, name string, data io.Reader) error

type Object

type Object struct {
	Name         string
	Size         int64
	LastModified time.Time
	Body         io.ReadCloser
}

type S3

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

func NewS3

func NewS3(bucket string, opt S3Options) *S3

func (*S3) Delete

func (s *S3) Delete(ctx context.Context, name string) error

func (*S3) Endpoint

func (s *S3) Endpoint() string

func (*S3) ExistBucket

func (s *S3) ExistBucket(ctx context.Context, name string) bool

func (*S3) ExistObject

func (s *S3) ExistObject(ctx context.Context, key string) bool

func (*S3) Get

func (s *S3) Get(ctx context.Context, name string) (*Object, error)

func (*S3) List

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

func (*S3) MakeBucket

func (s *S3) MakeBucket(ctx context.Context, name string) error

func (*S3) Name

func (s *S3) Name() string

func (*S3) Put

func (s *S3) Put(ctx context.Context, name string, data []byte) error

func (*S3) PutReader

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

type S3Options

type S3Options struct {
	Region          string
	AccessKey       string
	SecretAccessKey string
	Endpoint        string
	PathStyle       bool // This is important option if you want to use with MinIO.
	CACertFile      string
	PartSize        uint64
	Retries         int
	// contains filtered or unexported fields
}

func NewS3OptionToAWS

func NewS3OptionToAWS(region, accessKey, secretAccessKey string) S3Options

func NewS3OptionToExternal

func NewS3OptionToExternal(endpoint, region, accessKey, secretAccessKey string) S3Options

func (*S3Options) Client

func (s *S3Options) Client() (*s3.Client, error)

func (*S3Options) Uploader

func (s *S3Options) Uploader() (*manager.Uploader, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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