sharder

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sharder

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

Sharder determines the shard number for a key.

func New

func New(total int) *Sharder

New returns a new Sharder with the specified number of shards.

func (*Sharder) Index

func (s *Sharder) Index(key string) int

Index returns a shard index for the given key. The index is in the range 0..total exclusive.

Jump to

Keyboard shortcuts

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