shard

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDs

func IDs(shards []shard.Shard) []uint32

IDs returns a new slice of shard IDs for a set of shards

func NewShards

func NewShards(ids []uint32, state shard.State) []shard.Shard

NewShards returns a new slice of shards with a specified state

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`.

Types

type ShardSet

type ShardSet interface {
	// All returns a slice to the shards in this set
	All() []shard.Shard

	// AllIDs returns a slice to the shard IDs in this set
	AllIDs() []uint32
}

ShardSet contains a sharding function and a set of shards, this interface allows for potentially out of order shard sets

func NewShardSet

func NewShardSet(shards []shard.Shard) ShardSet

NewShardSet creates a new sharding scheme with a set of shards

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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