client

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 29 Imported by: 20

Documentation

Index

Constants

View Source
const PostQuorumTimeoutMs = 100

Variables

View Source
var ContainerNotFound = errors.New("Container Not Found")
View Source
var ErrValidTracerRequired = errors.New("valid tracer required")

ErrValidTracerRequired error

View Source
var NilContainerInfo = &ContainerInfo{}

NilContainerInfo is used for testing.

Functions

func NewDirectClient

func NewDirectClient(account string, cnf srv.ConfigLoader, certFile, keyFile string, logger srv.LowLevelLogger) (nectar.Client, error)

func NewTransport added in v1.4.0

func NewTransport(tracer opentracing.Tracer, rt http.RoundTripper, enableHTTPTrace bool) (http.RoundTripper, error)

NewTransport returns a new Opentracing instrumented http RoundTripper

Types

type ContainerInfo

type ContainerInfo struct {
	ReadACL            string
	WriteACL           string
	SyncKey            string
	ObjectCount        int64
	ObjectBytes        int64
	Metadata           map[string]string
	SysMetadata        map[string]string
	StoragePolicyIndex int
}

ContainerInfo is persisted in memcache via JSON; so this needs to continue to have public fields.

type ProxyClient

type ProxyClient interface {
	NewRequestClient(mc ring.MemcacheRing, lc map[string]*ContainerInfo, logger srv.LowLevelLogger) RequestClient
	Close() error
}

ProxyClient is the factory for RequestClients, and manages any persistent/shared client resources.

func NewProxyClient

func NewProxyClient(policyList conf.PolicyList, cnf srv.ConfigLoader, logger srv.LowLevelLogger, certFile, keyFile, readAffinity, writeAffinity, writeAffinityCount string, serverconf conf.Config) (ProxyClient, error)

type RequestClient added in v1.4.0

type RequestClient interface {
	PutAccount(ctx context.Context, account string, headers http.Header) *http.Response
	PostAccount(ctx context.Context, account string, headers http.Header) *http.Response
	GetAccountRaw(ctx context.Context, account string, options map[string]string, headers http.Header) *http.Response
	HeadAccount(ctx context.Context, account string, headers http.Header) *http.Response
	DeleteAccount(ctx context.Context, account string, headers http.Header) *http.Response
	PutContainer(ctx context.Context, account string, container string, headers http.Header) *http.Response
	PostContainer(ctx context.Context, account string, container string, headers http.Header) *http.Response
	GetContainerRaw(ctx context.Context, account string, container string, options map[string]string, headers http.Header) *http.Response
	GetContainerInfo(ctx context.Context, account string, container string) (*ContainerInfo, error)
	SetContainerInfo(ctx context.Context, account string, container string, resp *http.Response) (*ContainerInfo, error)
	HeadContainer(ctx context.Context, account string, container string, headers http.Header) *http.Response
	DeleteContainer(ctx context.Context, account string, container string, headers http.Header) *http.Response
	PutObject(ctx context.Context, account string, container string, obj string, headers http.Header, src io.Reader) *http.Response
	PostObject(ctx context.Context, account string, container string, obj string, headers http.Header) *http.Response
	GetObject(ctx context.Context, account string, container string, obj string, headers http.Header) *http.Response
	HeadObject(ctx context.Context, account string, container string, obj string, headers http.Header) *http.Response
	DeleteObject(ctx context.Context, account string, container string, obj string, headers http.Header) *http.Response
	// ObjectRingFor returns the object ring for the given account/container or
	// a response as to why the ring could not be returned.
	ObjectRingFor(ctx context.Context, account string, container string) (ring.Ring, *http.Response)
	ContainerRing() ring.Ring
	AccountRing() ring.Ring
	SetUserAgent(string)
}

RequestClient is similar to github.com/troubling/nectar.Client, but its calls accept a context and it is scoped to a specific API request.

type TracingClient added in v1.4.0

type TracingClient struct {
	*http.Client
	// contains filtered or unexported fields
}

TracingClient holds a opentracing instrumented HTTP Client.

func NewTracingClient added in v1.4.0

func NewTracingClient(tracer opentracing.Tracer, httpClient *http.Client, enableHTTPTrace bool) (*TracingClient, error)

NewTracingClient returns an HTTP Client adding Opentracing instrumentation around an embedded standard Go http.Client.

func (*TracingClient) Do added in v1.4.0

func (tc *TracingClient) Do(req *http.Request) (*http.Response, error)

Do wraps http.Client's Do with tracing using an application span.

Jump to

Keyboard shortcuts

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