sharder

package
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotZonable = errors.New("given object is not shardable")

ErrNotZonable indicates that the object is Shardable and cannot be sharded.

Functions

func New

func New(hasher Hasher) manipmongo.Sharder

New returns a new manipmongo.Sharder.

Types

type Hasher

type Hasher interface {

	// Zone returns the zone for the given identity.
	Zone(elemental.Identity) int

	// Hash performs the zoning/hashing for the given identifiable.
	// This method is responsible to set the Zone and the ZHash of the
	// provided Identifiable.
	Hash(Shardable) error
}

A Hasher is used to zone/zhash an identifiable.

type Shardable

type Shardable interface {
	GetZone() int
	SetZone(int)
	GetZHash() int
	SetZHash(int)
	elemental.Identifiable
}

A Shardable is the interface an object must implement in order to be shardable.

Jump to

Keyboard shortcuts

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