Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // NoShardingSharderID is the sharder id used where no sharding is applicable. // It maps all inputs to a single shard. NoShardingSharderID = SharderID{/* contains filtered or unexported fields */} )
Functions ¶
This section is empty.
Types ¶
type AggregatedShardFn ¶
AggregatedShardFn maps a chunked id to a shard.
type AggregatedSharder ¶
type AggregatedSharder struct {
// contains filtered or unexported fields
}
AggregatedSharder maps an aggregated metric to a shard.
func NewAggregatedSharder ¶
func NewAggregatedSharder(sharderID SharderID) (AggregatedSharder, error)
NewAggregatedSharder creates a new aggregated sharder.
func (*AggregatedSharder) ID ¶
func (s *AggregatedSharder) ID() SharderID
ID returns the sharder id.
type HashType ¶
type HashType string
HashType is the hashing type.
const ( // Murmur32Hash represents the murmur3 hash. Murmur32Hash HashType = "murmur32" DefaultHash = Murmur32Hash )
List of supported hashing types.
func (HashType) AggregatedShardFn ¶
func (t HashType) AggregatedShardFn() (AggregatedShardFn, error)
AggregatedShardFn returns the sharding function for computing aggregated shards.
func (HashType) MustShardFn ¶
MustShardFn returns the sharding function, or panics if an error is encountered.
func (*HashType) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML object into a hash type.
type ShardSet ¶
type ShardSet map[uint32]struct{}
ShardSet is a collection of shards organized as a set. The shards contained in the set can be discontinuous.
func MustParseShardSet ¶
MustParseShardSet parses a shard set from the input string, and panics if parsing is unsuccessful.
func ParseShardSet ¶
ParseShardSet parses a shard set from the input string.
func (ShardSet) AddBetween ¶
AddBetween adds shards between the given min (inclusive) and max (exclusive).
func (ShardSet) ParseRange ¶
ParseRange parses a range of shards and adds them to the set.
func (*ShardSet) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML into a shard set. The following formats are supported: * StartShard..EndShard, e.g., 0..63. * Single shard, e.g., 5. * Array containing shard ranges and single shards.
type SharderID ¶
type SharderID struct {
// contains filtered or unexported fields
}
SharderID uniquely identifies a sharder.
func NewSharderID ¶
NewSharderID creates a new sharder id.