Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
RoutingTable makes decisions for where a item should be routed.
func NewRoutingTable ¶
func NewRoutingTable(localNode int, addrs []string, replicationFactor uint) (*RoutingTable, error)
NewRoutingTable returns a new RoutingTable.
func (*RoutingTable) IsLocal ¶
func (t *RoutingTable) IsLocal(metricName string) bool
func (*RoutingTable) Lookup ¶
func (t *RoutingTable) Lookup(item string) []int
Lookup takes a item, hash it and determine what node(s) it should be routed to.
type StaticLookup ¶
type StaticLookup struct {
// contains filtered or unexported fields
}
StaticLookup is used to do lookup for static routes.
func NewStaticLookup ¶
func NewStaticLookup(numOfRoutes int, hasher func(string) uint64) *StaticLookup
NewStaticLookup creates and returns a StaticLookup.
func (*StaticLookup) Lookup ¶
func (l *StaticLookup) Lookup(sourceId string) int
Lookup hashes the SourceId and then returns the index that is in range of the hash.
Click to show internal directories.
Click to hide internal directories.