sharding

package
v0.0.0-...-49e5460 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cast   HashMethod = "cast"
	MD5               = "md5"
	SHA1              = "sha1"
	SHA256            = "sha256"
	SHA512            = "sha512"
)

Variables

This section is empty.

Functions

func CastFunc

func CastFunc(key interface{}) (uint64, error)

func CombineKeys

func CombineKeys(keys []interface{}) interface{}

func MD5Func

func MD5Func(key interface{}) (uint64, error)

func SHA1Func

func SHA1Func(key interface{}) (uint64, error)

func SHA256Func

func SHA256Func(key interface{}) (uint64, error)

func SHA512Func

func SHA512Func(key interface{}) (uint64, error)

Types

type HashFunc

type HashFunc func(interface{}) (uint64, error)

Method for taking the shard-key and returning a hashed value

type HashMethod

type HashMethod string

func (HashMethod) Get

func (h HashMethod) Get() HashFunc

type ShardFunc

type ShardFunc func(uint64, int) int

Take a hash value and select a shard

type ShardMethod

type ShardMethod string
const (
	Jump ShardMethod = "jump"
	Mod              = "mod"
)

func (ShardMethod) Get

func (s ShardMethod) Get() ShardFunc

Jump to

Keyboard shortcuts

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