common

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package common contains shared logic between docker and in-process M3 implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ZapMethod

func ZapMethod(s string) zapcore.Field

ZapMethod appends the method as a log field.

Types

type CoordinatorClient

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

CoordinatorClient is a client use to invoke API calls on a coordinator

func NewCoordinatorClient

func NewCoordinatorClient(opts CoordinatorClientOptions) CoordinatorClient

NewCoordinatorClient creates a new CoordinatorClient.

func (*CoordinatorClient) AddM3msgTopicConsumer

func (c *CoordinatorClient) AddM3msgTopicConsumer(
	topicOpts resources.M3msgTopicOptions,
	addRequest admin.TopicAddRequest,
) (admin.TopicGetResponse, error)

AddM3msgTopicConsumer adds a consumer service to an m3msg topic

func (*CoordinatorClient) AddNamespace

func (c *CoordinatorClient) AddNamespace(
	addRequest admin.NamespaceAddRequest,
) (admin.NamespaceGetResponse, error)

AddNamespace adds a namespace.

func (*CoordinatorClient) ApplyKVUpdate

func (c *CoordinatorClient) ApplyKVUpdate(update string) error

ApplyKVUpdate applies a KV update.

func (*CoordinatorClient) CreateDatabase

func (c *CoordinatorClient) CreateDatabase(
	addRequest admin.DatabaseCreateRequest,
) (admin.DatabaseCreateResponse, error)

CreateDatabase creates a database.

func (*CoordinatorClient) DeleteNamespace

func (c *CoordinatorClient) DeleteNamespace(namespaceID string) error

DeleteNamespace removes the namespace.

func (*CoordinatorClient) GetM3msgTopic

func (c *CoordinatorClient) GetM3msgTopic(
	topicOpts resources.M3msgTopicOptions,
) (admin.TopicGetResponse, error)

GetM3msgTopic fetches an m3msg topic

func (*CoordinatorClient) GetNamespace

func (c *CoordinatorClient) GetNamespace() (admin.NamespaceGetResponse, error)

GetNamespace gets namespaces.

func (*CoordinatorClient) GetPlacement

GetPlacement gets placements.

func (*CoordinatorClient) InitM3msgTopic

func (c *CoordinatorClient) InitM3msgTopic(
	topicOpts resources.M3msgTopicOptions,
	initRequest admin.TopicInitRequest,
) (admin.TopicGetResponse, error)

InitM3msgTopic initializes an m3msg topic

func (*CoordinatorClient) InitPlacement

InitPlacement initializes placements.

func (*CoordinatorClient) RunQuery

func (c *CoordinatorClient) RunQuery(
	verifier resources.ResponseVerifier, query string, headers map[string][]string,
) error

RunQuery runs the given query with a given verification function.

func (*CoordinatorClient) UpdateNamespace

UpdateNamespace updates the namespace.

func (*CoordinatorClient) WaitForInstances

func (c *CoordinatorClient) WaitForInstances(
	ids []string,
) error

WaitForInstances blocks until the given instance is available.

func (*CoordinatorClient) WaitForNamespace

func (c *CoordinatorClient) WaitForNamespace(name string) error

WaitForNamespace blocks until the given namespace is enabled. NB: if the name string is empty, this will instead check for a successful response.

func (*CoordinatorClient) WaitForShardsReady

func (c *CoordinatorClient) WaitForShardsReady() error

WaitForShardsReady waits until all shards gets ready.

func (*CoordinatorClient) WriteCarbon

func (c *CoordinatorClient) WriteCarbon(
	url string, metric string, v float64, t time.Time,
) error

WriteCarbon writes a carbon metric datapoint at a given time.

func (*CoordinatorClient) WriteProm

func (c *CoordinatorClient) WriteProm(name string, tags map[string]string, samples []prompb.Sample) error

WriteProm writes a prometheus metric.

type CoordinatorClientOptions

type CoordinatorClientOptions struct {
	Client    *http.Client
	HTTPPort  int
	Logger    *zap.Logger
	RetryFunc RetryFunc
}

CoordinatorClientOptions are the options for the CoordinatorClient.

type RetryFunc

type RetryFunc func(op func() error) error

RetryFunc is a function that retries the provided operation until successful.

Jump to

Keyboard shortcuts

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