testutil

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewTopologyMap

func MustNewTopologyMap(
	replicas int,
	assignment map[string][]shard.Shard,
) topology.Map

MustNewTopologyMap returns a new topology.Map with provided parameters. It's a utility method to make tests easier to write.

func Shards

func Shards(ids []uint32, s shard.State) []shard.Shard

Shards returns a slice of shards with provided ids and state `s`.

func ShardsRange

func ShardsRange(from, to uint32, s shard.State) []shard.Shard

ShardsRange returns a slice of shards for all ids between [from, to], with shard state `s`.

func Uint32Range

func Uint32Range(from, to uint32) []uint32

Uint32Range returns a slice of all values between [from, to].

Types

type TopologyView

type TopologyView struct {
	HashFn     sharding.HashFn
	Replicas   int
	Assignment map[string][]shard.Shard
}

TopologyView represents a snaphshot view of a topology.Map.

func NewTopologyView

func NewTopologyView(
	replicas int,
	assignment map[string][]shard.Shard,
) TopologyView

NewTopologyView returns a new TopologyView with provided parameters. It's a utility method to make tests easier to write.

func (TopologyView) Map

func (v TopologyView) Map() (topology.Map, error)

Map returns the topology.Map corresponding to a TopologyView.

Jump to

Keyboard shortcuts

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