Documentation ¶
Index ¶
- Constants
- func NewOssObjectClient(_ context.Context, cfg OssConfig) (client.ObjectClient, error)
- type OssConfig
- type OssObjectClient
- func (s *OssObjectClient) DeleteObject(ctx context.Context, objectKey string) error
- func (s *OssObjectClient) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, int64, error)
- func (s *OssObjectClient) GetObjectRange(ctx context.Context, objectKey string, offset, length int64) (io.ReadCloser, error)
- func (s *OssObjectClient) IsObjectNotFoundErr(err error) bool
- func (s *OssObjectClient) IsRetryableErr(error) bool
- func (s *OssObjectClient) List(ctx context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
- func (s *OssObjectClient) ObjectExists(ctx context.Context, objectKey string) (bool, error)
- func (s *OssObjectClient) PutObject(ctx context.Context, objectKey string, object io.Reader) error
- func (s *OssObjectClient) Stop()
Constants ¶
const NoSuchKeyErr = "NoSuchKey"
Variables ¶
This section is empty.
Functions ¶
func NewOssObjectClient ¶
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 ¶
RegisterFlags registers flags.
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) GetObjectRange ¶ added in v3.2.0
func (s *OssObjectClient) GetObjectRange(ctx context.Context, objectKey string, offset, length int64) (io.ReadCloser, 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 (*OssObjectClient) PutObject ¶
PutObject puts the specified bytes into the configured OSS bucket at the provided key
func (*OssObjectClient) Stop ¶
func (s *OssObjectClient) Stop()