slot

package
v0.0.0-...-0227cab Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RedisMaxSlots = 16384
)

Variables

This section is empty.

Functions

func IsFullfilled

func IsFullfilled(slots ...*Slots) bool

Types

type SlotAssignStatus

type SlotAssignStatus int

SlotAssignStatus slot assign status

const (
	// SlotUnAssigned - slot assigned
	SlotUnAssigned SlotAssignStatus = 0
	// SlotImporting - slot is in importing status
	SlotImporting SlotAssignStatus = 1
	// SlotAssigned - slot is assigned
	SlotAssigned SlotAssignStatus = 2
	// SlotMigrating - slot is in migrating status
	SlotMigrating SlotAssignStatus = 3
)

func NewSlotAssignStatusFromString

func NewSlotAssignStatusFromString(v string) SlotAssignStatus

func (SlotAssignStatus) String

func (s SlotAssignStatus) String() string

type Slots

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

func Allocate

func Allocate(desired int, shards []*Slots) (ret []*Slots)

Allocate

func LoadSlots

func LoadSlots(v interface{}) (*Slots, error)

func NewFullSlots

func NewFullSlots() *Slots

func NewSlots

func NewSlots() *Slots

func (*Slots) Count

func (s *Slots) Count(status SlotAssignStatus) (c int)

func (*Slots) Equals

func (s *Slots) Equals(old *Slots) bool

Equals check if this two slots equals (no care about the status)

func (*Slots) Inter

func (s *Slots) Inter(n *Slots) *Slots

Inter return the intersection with n (no care about the status)

func (*Slots) IsFullfilled

func (s *Slots) IsFullfilled() bool

IsFullfilled check if this slots if fullfilled

func (*Slots) IsSet

func (s *Slots) IsSet(i int) bool

func (*Slots) Load

func (s *Slots) Load(v interface{}) error

func (*Slots) MoveingStatus

func (s *Slots) MoveingStatus(i int) (SlotAssignStatus, string)

func (*Slots) Set

func (s *Slots) Set(v interface{}, status SlotAssignStatus) error

Set

func (*Slots) Slots

func (s *Slots) Slots() (ret []int)

Slots

func (*Slots) Status

func (s *Slots) Status(i int) SlotAssignStatus

func (*Slots) String

func (s *Slots) String() string

String

func (*Slots) Sub

func (s *Slots) Sub(n *Slots) *Slots

func (*Slots) Union

func (s *Slots) Union(slots ...*Slots) *Slots

Union ignore slot status

Jump to

Keyboard shortcuts

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