Documentation
¶
Overview ¶
Package common defines reusable objects for APIs.
Index ¶
- Variables
- func DBLabelNames() []string
- func ParseNodeFlags() map[string]string
- func SegLabelNames() []string
- func SetPosition(ctx context.Context, fn func(p Position) Position) context.Context
- func ShardLabelNames() []string
- type Error
- type ItemID
- type KindVersion
- type Node
- type NodeHostProvider
- type Position
- type SeriesID
- type ShardID
Constants ¶
This section is empty.
Variables ¶
var ( // FlagNodeHost is the node id from flag. FlagNodeHost string // FlagNodeHostProvider is the node id provider from flag. FlagNodeHostProvider NodeHostProvider // FlagNodeLabels is the node labels from flag. FlagNodeLabels []string )
var ContextNodeKey = contextNodeKey{}
ContextNodeKey is a context key to store the node id.
var ContextNodeRolesKey = contextNodeRolesKey{}
ContextNodeRolesKey is a context key to store the node roles.
var ContextNodeSelectorKey = contextNodeSelectorKey{}
ContextNodeSelectorKey is a context key to store the node selector.
Functions ¶
func DBLabelNames ¶ added in v0.7.0
func DBLabelNames() []string
DBLabelNames returns the label names of Position in the database level.
func ParseNodeFlags ¶ added in v0.8.0
ParseNodeFlags parses the node labels from flag.
func SegLabelNames ¶ added in v0.7.0
func SegLabelNames() []string
SegLabelNames returns the label names of Position in the segment level.
func SetPosition ¶
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 NewErrorWithStatus ¶ added in v0.8.0
NewErrorWithStatus returns a new Error with status.
type KindVersion ¶
KindVersion contains elements which identify the API uniquely.
func (*KindVersion) String ¶
func (s *KindVersion) String() string
type Node ¶ added in v0.5.0
type Node struct {
Labels map[string]string
NodeID string
GrpcAddress string
HTTPAddress string
PropertyGossipGrpcAddress string
}
Node contains the node id and address.
func GenerateNode ¶ added in v0.5.0
GenerateNode generates a node id.
type NodeHostProvider ¶ added in v0.5.0
type NodeHostProvider int
NodeHostProvider is the provider of node id.
const ( NodeHostProviderHostname NodeHostProvider = iota NodeHostProviderIP NodeHostProviderFlag )
NodeIDProvider constants.
func ParseNodeHostProvider ¶ added in v0.5.0
func ParseNodeHostProvider(s string) (NodeHostProvider, error)
ParseNodeHostProvider parses the string to NodeIDProvider.
func (*NodeHostProvider) String ¶ added in v0.5.0
func (n *NodeHostProvider) String() string
String returns the string representation of NodeIDProvider.
type Position ¶
Position is stored in the context. The logger could attach it for debugging.
func GetPosition ¶ added in v0.4.0
GetPosition returns the position from ctx.
func (Position) DBLabelValues ¶ added in v0.7.0
DBLabelValues returns the label values of Position in the database level.
func (Position) SegLabelValues ¶ added in v0.7.0
SegLabelValues returns the label values of Position.
func (Position) ShardLabelValues ¶ added in v0.4.0
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) AppendToBytes ¶ added in v0.6.0
AppendToBytes appends series id to bytes.