Documentation ¶
Overview ¶
Package common defines reusable objects for APIs.
Index ¶
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 )
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.
Functions ¶
func DBLabelNames ¶ added in v0.7.0
func DBLabelNames() []string
DBLabelNames returns the label names of Position in the database level.
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.
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
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.