shard

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SLOTS_NUM = 1 << 14
)

Variables

This section is empty.

Functions

func CRC16Sum

func CRC16Sum(key string) uint16

Types

type Node

type Node struct {
	ID    string     `json:"id"`
	Slots SlotsRange `json:"slots"`
}

type SlotsManager

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

func InitSlotManager

func InitSlotManager(startNodes []Node) *SlotsManager

func RestoreSlotsManager

func RestoreSlotsManager(nds []Node) (*SlotsManager, error)

func (*SlotsManager) Check

func (sm *SlotsManager) Check()

func (*SlotsManager) NodeByKey

func (sm *SlotsManager) NodeByKey(key string) (*Node, error)

func (*SlotsManager) NodeBySlot

func (sm *SlotsManager) NodeBySlot(n uint16) (*Node, error)

func (*SlotsManager) Nodes

func (sm *SlotsManager) Nodes() []Node

type SlotsRange

type SlotsRange struct {
	Start uint16 `json:"start"`
	End   uint16 `json:"end"`
}

Jump to

Keyboard shortcuts

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