alibaba

package
v1.6.2-0...-b66c343 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const NoSuchKeyErr = "NoSuchKey"

Variables

This section is empty.

Functions

func NewOssObjectClient

func NewOssObjectClient(_ context.Context, cfg OssConfig) (client.ObjectClient, error)

NewOssObjectClient makes a new chunk.Client that writes chunks to OSS.

Types

type OssConfig

type OssConfig struct {
	Bucket          string `yaml:"bucket"`
	Endpoint        string `yaml:"endpoint"`
	AccessKeyID     string `yaml:"access_key_id"`
	SecretAccessKey string `yaml:"secret_access_key"`
}

OssConfig is config for the OSS Chunk Client.

func (*OssConfig) RegisterFlags

func (cfg *OssConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

func (*OssConfig) RegisterFlagsWithPrefix

func (cfg *OssConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix registers flags with prefix.

type OssObjectClient

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

func (*OssObjectClient) DeleteObject

func (s *OssObjectClient) DeleteObject(ctx context.Context, objectKey string) error

DeleteObject deletes the specified object key from the configured OSS bucket.

func (*OssObjectClient) GetObject

func (s *OssObjectClient) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, int64, error)

GetObject returns a reader and the size for the specified object key from the configured OSS bucket.

func (*OssObjectClient) IsObjectNotFoundErr

func (s *OssObjectClient) IsObjectNotFoundErr(err error) bool

IsObjectNotFoundErr returns true if error means that object is not found. Relevant to GetObject and DeleteObject operations.

func (*OssObjectClient) IsRetryableErr

func (s *OssObjectClient) IsRetryableErr(error) bool

TODO(dannyk): implement for client

func (*OssObjectClient) List

func (s *OssObjectClient) List(ctx context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)

List implements chunk.ObjectClient.

func (*OssObjectClient) ObjectExists

func (s *OssObjectClient) ObjectExists(ctx context.Context, objectKey string) (bool, error)

func (*OssObjectClient) PutObject

func (s *OssObjectClient) PutObject(ctx context.Context, objectKey string, object io.ReadSeeker) error

PutObject puts the specified bytes into the configured OSS bucket at the provided key

func (*OssObjectClient) Stop

func (s *OssObjectClient) Stop()

Jump to

Keyboard shortcuts

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