consistenthash

package
v0.0.0-...-7ef8827 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2016 License: AGPL-3.0, AGPL-3.0-only Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InsufficientPositionsError = &insufficientPositionsError{}
)
View Source
var (
	TooManyDisabledHashCodes = &tooManyDisabledHashCodes{}
)
View Source
var (
	VarUUIdNotKnown = &varUUIdNotKnown{}
)

Functions

This section is empty.

Types

type CombinationPicker

type CombinationPicker struct {
	// contains filtered or unexported fields
}

func NewCombinationPicker

func NewCombinationPicker(desiredLen int, disabledHashCodes map[common.RMId]server.EmptyStruct) *CombinationPicker

Here, you want desiredLen to be FInc

func (*CombinationPicker) AddPermutation

func (cp *CombinationPicker) AddPermutation(perm common.RMIds)

func (*CombinationPicker) Choose

func (cp *CombinationPicker) Choose() (common.RMIds, common.RMIds, error)

type ConsistentHashCache

type ConsistentHashCache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(resolver *Resolver, rng *rand.Rand) *ConsistentHashCache

func (*ConsistentHashCache) AddPosition

func (chc *ConsistentHashCache) AddPosition(vUUId *common.VarUUId, pos *common.Positions)

func (*ConsistentHashCache) CreatePositions

func (chc *ConsistentHashCache) CreatePositions(vUUId *common.VarUUId, positionsLength int) (*common.Positions, []common.RMId, error)

In here, we don't actually add to the cache because we don't know if the corresponding txn is going to commit or not.

func (*ConsistentHashCache) GetHashCodes

func (chc *ConsistentHashCache) GetHashCodes(vUUId *common.VarUUId) ([]common.RMId, error)

func (*ConsistentHashCache) GetPositions

func (chc *ConsistentHashCache) GetPositions(vUUId *common.VarUUId) *common.Positions

func (*ConsistentHashCache) Remove

func (chc *ConsistentHashCache) Remove(vUUId *common.VarUUId)

func (*ConsistentHashCache) SetResolver

func (chc *ConsistentHashCache) SetResolver(resolver *Resolver)

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(hashCodes common.RMIds, desiredLength uint16) *Resolver

hashCodes is the rmIds from topology - i.e. it can contain RMIdEmpty, and those RMIdEmpties do not contibute to the desiredLength. Here, you want desiredLength to be TwoFInc

func (*Resolver) RMIdHasVar

func (r *Resolver) RMIdHasVar(rmIdIdx int, positions []uint8) (bool, error)

rmIdIdx is the index of the rmId in question within the topology.RMs() slice.

func (*Resolver) ResolveHashCodes

func (r *Resolver) ResolveHashCodes(positions []uint8) (common.RMIds, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL