Documentation ¶
Index ¶
- Variables
- func DefaultTransport(c HTTPConfig) *http.Transport
- func NewTestBucket(t testing.TB) (objstore.Bucket, func(), error)
- type Bucket
- func (b *Bucket) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error)
- func (b *Bucket) Close() error
- func (b *Bucket) Delete(ctx context.Context, name string) error
- func (b *Bucket) Exists(ctx context.Context, name string) (bool, error)
- func (b *Bucket) Get(ctx context.Context, name string) (io.ReadCloser, error)
- func (b *Bucket) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)
- func (b *Bucket) IsObjNotFoundErr(err error) bool
- func (b *Bucket) Iter(ctx context.Context, dir string, f func(string) error, ...) error
- func (b *Bucket) Name() string
- func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error
- type Config
- type HTTPConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ HTTPConfig: HTTPConfig{ IdleConnTimeout: model.Duration(90 * time.Second), ResponseHeaderTimeout: model.Duration(2 * time.Minute), TLSHandshakeTimeout: model.Duration(10 * time.Second), ExpectContinueTimeout: model.Duration(1 * time.Second), MaxIdleConns: 100, MaxIdleConnsPerHost: 100, MaxConnsPerHost: 0, }, }
DefaultConfig is the default config for an cos client. default tune the `MaxIdleConnsPerHost`.
Functions ¶
func DefaultTransport ¶ added in v0.23.0
func DefaultTransport(c HTTPConfig) *http.Transport
DefaultTransport build http.Transport from config.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket implements the store.Bucket interface against cos-compatible(Tencent Object Storage) APIs.
func (*Bucket) Attributes ¶ added in v0.14.0
Attributes returns information about the specified object.
func (*Bucket) GetRange ¶
func (b *Bucket) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)
GetRange returns a new range reader for the given object name and range.
func (*Bucket) IsObjNotFoundErr ¶
IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations.
type Config ¶
type Config struct { Bucket string `yaml:"bucket"` Region string `yaml:"region"` AppId string `yaml:"app_id"` SecretKey string `yaml:"secret_key"` SecretId string `yaml:"secret_id"` HTTPConfig HTTPConfig `yaml:"http_config"` }
Config encapsulates the necessary config values to instantiate an cos client.
type HTTPConfig ¶ added in v0.23.0
type HTTPConfig struct { IdleConnTimeout model.Duration `yaml:"idle_conn_timeout"` ResponseHeaderTimeout model.Duration `yaml:"response_header_timeout"` TLSHandshakeTimeout model.Duration `yaml:"tls_handshake_timeout"` ExpectContinueTimeout model.Duration `yaml:"expect_continue_timeout"` MaxIdleConns int `yaml:"max_idle_conns"` MaxIdleConnsPerHost int `yaml:"max_idle_conns_per_host"` MaxConnsPerHost int `yaml:"max_conns_per_host"` }
HTTPConfig stores the http.Transport configuration for the cos client.
Click to show internal directories.
Click to hide internal directories.