common

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package common defines reusable objects for APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelNames added in v0.4.0

func LabelNames() []string

LabelNames returns the label names of Position.

func SetPosition

func SetPosition(ctx context.Context, fn func(p Position) Position) context.Context

SetPosition sets a position returned from fn to attach it to ctx, then return a new context.

func ShardLabelNames added in v0.4.0

func ShardLabelNames() []string

ShardLabelNames returns the label names of Position. It is used for shard level metrics.

Types

type Error added in v0.2.0

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

Error wraps a error msg.

func NewError added in v0.2.0

func NewError(tpl string, args ...any) Error

NewError returns a new Error.

func (Error) Msg added in v0.2.0

func (e Error) Msg() string

Msg shows the string msg.

type ItemID

type ItemID uint64

ItemID identities an item in a series.

type KindVersion

type KindVersion struct {
	Version string
	Kind    string
}

KindVersion contains elements which identify the API uniquely.

func (*KindVersion) String

func (s *KindVersion) String() string

type Position

type Position struct {
	Module   string
	Database string
	Shard    string
	Segment  string
	Block    string
}

Position is stored in the context. The logger could attach it for debugging.

func GetPosition added in v0.4.0

func GetPosition(ctx context.Context) Position

GetPosition returns the position from ctx.

func (Position) LabelValues added in v0.4.0

func (p Position) LabelValues() []string

LabelValues returns the label values of Position.

func (Position) ShardLabelValues added in v0.4.0

func (p Position) ShardLabelValues() []string

ShardLabelValues returns the label values of Position. It is used for shard level metrics.

type SeriesID

type SeriesID uint64

SeriesID identities a series in a shard.

func (SeriesID) Marshal

func (s SeriesID) Marshal() []byte

Marshal encodes series id to bytes.

type ShardID

type ShardID uint32

ShardID identities a shard in a tsdb.

Jump to

Keyboard shortcuts

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