cos

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBucketClient

func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucket, error)

NewBucketClient creates a bucket client for COS

Types

type Config

type Config struct {
	Bucket    string     `yaml:"bucket"`
	Region    string     `yaml:"region"`
	AppID     string     `yaml:"app_id"`
	Endpoint  string     `yaml:"endpoint"`
	SecretKey string     `yaml:"secret_key"`
	SecretID  string     `yaml:"secret_id"`
	HTTP      HTTPConfig `yaml:"http"`
}

Config encapsulates the necessary config values to instantiate an cos client.

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers the flags for COS storage

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix register the flags for COS storage with provided prefix

func (*Config) Validate

func (c *Config) Validate() error

Validate validates cos client config and returns error on failure

type HTTPConfig

type HTTPConfig struct {
	IdleConnTimeout       time.Duration `yaml:"idle_conn_timeout" category:"advanced"`
	ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout" category:"advanced"`
	InsecureSkipVerify    bool          `yaml:"insecure_skip_verify" category:"advanced"`
	TLSHandshakeTimeout   time.Duration `yaml:"tls_handshake_timeout" category:"advanced"`
	ExpectContinueTimeout time.Duration `yaml:"expect_continue_timeout" category:"advanced"`
	MaxIdleConns          int           `yaml:"max_idle_connections" category:"advanced"`
	MaxIdleConnsPerHost   int           `yaml:"max_idle_connections_per_host" category:"advanced"`
	MaxConnsPerHost       int           `yaml:"max_connections_per_host" category:"advanced"`

	// Allow upstream callers to inject a round tripper
	Transport http.RoundTripper `yaml:"-"`
}

HTTPConfig stores the http.Transport configuration for the COS client.

func (*HTTPConfig) RegisterFlagsWithPrefix

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

RegisterFlagsWithPrefix registers the flags for COS storage with the provided prefix

Jump to

Keyboard shortcuts

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