Documentation ¶
Index ¶
- Constants
- type NodeInfo
- type NodePerf
- type Option
- func WithAlwaysMainFirst() Option
- func WithCorrectnessPct(pct float64) Option
- func WithCorrectnessWindowSize(n int) Option
- func WithFailureDebounce(n time.Duration) Option
- func WithLatencyWindowSize(n int) Option
- func WithMaxMainTierSize(n int) Option
- func WithMaxPoolSize(n int) Option
- func WithNoRemove(noRemove bool) Option
- type PoolMetrics
- type RemovedNode
- type ResponseMetrics
- type Tier
- type TieredHashing
- func (t *TieredHashing) AddOrchestratorNodes(nodes []NodeInfo) (added, alreadyRemoved, removedAndAddedBack int)
- func (t *TieredHashing) DoRefresh() bool
- func (t *TieredHashing) GetComplianceCid(ip string) (string, error)
- func (t *TieredHashing) GetNodes(from Tier, key string, n int) []string
- func (t *TieredHashing) GetPerf() map[string]*NodePerf
- func (t *TieredHashing) GetPoolMetrics() PoolMetrics
- func (t *TieredHashing) IsInitDone() bool
- func (t *TieredHashing) MoveBestUnknownToMain() int
- func (t *TieredHashing) NodeTier(node string) Tier
- func (t *TieredHashing) RecordFailure(node string, rm ResponseMetrics) *RemovedNode
- func (t *TieredHashing) RecordSuccess(node string, rm ResponseMetrics)
- func (t *TieredHashing) UpdateMainTierWithTopN() (mainToUnknown, unknownToMain int)
- type TieredHashingConfig
Constants ¶
View Source
const ( PLatency = 90 PMaxLatencyWithoutWindowing = 100 // main tier has the top `maxMainTierSize` nodes TierMain = Tier("main") TierUnknown = Tier("unknown") )
TODO Make env vars for tuning
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodePerf ¶
type NodePerf struct { LatencyDigest *rolling.PointPolicy NLatencyDigest float64 CorrectnessDigest *rolling.PointPolicy NCorrectnessDigest float64 Tier // Node Info NodeInfo // contains filtered or unexported fields }
type Option ¶
type Option func(config *TieredHashingConfig)
func WithAlwaysMainFirst ¶
func WithAlwaysMainFirst() Option
func WithCorrectnessPct ¶
func WithFailureDebounce ¶
func WithLatencyWindowSize ¶
func WithMaxMainTierSize ¶
func WithMaxPoolSize ¶
func WithNoRemove ¶ added in v0.0.2
type PoolMetrics ¶
type RemovedNode ¶
type ResponseMetrics ¶
type TieredHashing ¶
locking is left to the caller
func New ¶
func New(opts ...Option) *TieredHashing
func (*TieredHashing) AddOrchestratorNodes ¶
func (t *TieredHashing) AddOrchestratorNodes(nodes []NodeInfo) (added, alreadyRemoved, removedAndAddedBack int)
func (*TieredHashing) DoRefresh ¶
func (t *TieredHashing) DoRefresh() bool
func (*TieredHashing) GetComplianceCid ¶ added in v0.0.3
func (t *TieredHashing) GetComplianceCid(ip string) (string, error)
func (*TieredHashing) GetNodes ¶
func (t *TieredHashing) GetNodes(from Tier, key string, n int) []string
func (*TieredHashing) GetPerf ¶
func (t *TieredHashing) GetPerf() map[string]*NodePerf
func (*TieredHashing) GetPoolMetrics ¶
func (t *TieredHashing) GetPoolMetrics() PoolMetrics
func (*TieredHashing) IsInitDone ¶
func (t *TieredHashing) IsInitDone() bool
func (*TieredHashing) MoveBestUnknownToMain ¶ added in v0.0.2
func (t *TieredHashing) MoveBestUnknownToMain() int
func (*TieredHashing) NodeTier ¶ added in v0.0.2
func (t *TieredHashing) NodeTier(node string) Tier
func (*TieredHashing) RecordFailure ¶
func (t *TieredHashing) RecordFailure(node string, rm ResponseMetrics) *RemovedNode
func (*TieredHashing) RecordSuccess ¶
func (t *TieredHashing) RecordSuccess(node string, rm ResponseMetrics)
func (*TieredHashing) UpdateMainTierWithTopN ¶
func (t *TieredHashing) UpdateMainTierWithTopN() (mainToUnknown, unknownToMain int)
Click to show internal directories.
Click to hide internal directories.