rebalance

package
v0.0.0-...-70c2fae Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

Description

A demo to explain how codis rebalance works.

go test -v ./...

Documentation

Index

Constants

View Source
const (
	ActionNothing   = ""
	ActionPending   = "pending"
	ActionPreparing = "preparing"
	ActionPrepared  = "prepared"
	ActionMigrating = "migrating"
	ActionFinished  = "finished"
	ActionSyncing   = "syncing"
)
View Source
const MaxSlotNum = 1024

Variables

This section is empty.

Functions

func MaxInt

func MaxInt(a, b int) int

func SlotsRebalance

func SlotsRebalance(ctx *context) (map[int]int, map[int]int, error)

Types

type Group

type Group struct {
	Id int `json:"id"`
}

type Slot

type Slot struct {
	Id int `json:"id"`
}

type SlotMapping

type SlotMapping struct {
	Id      int `json:"id"`
	GroupId int `json:"group_id"`

	Action struct {
		Index    int    `json:"index,omitempty"`
		State    string `json:"state,omitempty"`
		TargetId int    `json:"target_id,omitempty"`
	} `json:"action"`
}

Jump to

Keyboard shortcuts

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