partitions

package
v0.0.0-...-73798e1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assigner

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

Assigner is the one that assigns partitions to servers.

func NewAssigner

func NewAssigner(store storage.Store) *Assigner

func (*Assigner) Start

func (a *Assigner) Start(ctx context.Context) error

func (*Assigner) Stop

func (a *Assigner) Stop()

type PartitionState

type PartitionState struct {
	Id      uint32
	Serving map[uint64]bool
	Joining map[uint64]bool
	Leaving map[uint64]bool
}

func (PartitionState) Clone

func (s PartitionState) Clone() PartitionState

func (PartitionState) JoiningCount

func (s PartitionState) JoiningCount() int

func (PartitionState) ServingCount

func (s PartitionState) ServingCount() int

func (PartitionState) TotalCount

func (s PartitionState) TotalCount() int

type ReplicaState

type ReplicaState struct {
	Pid         uint32
	Name        string
	CreatedTime time.Time
	Ready       bool
}

type ServerState

type ServerState struct {
	Id      uint64
	Serving map[uint32]bool
	Joining map[uint32]bool
	Leaving map[uint32]bool
}

func (ServerState) Clone

func (s ServerState) Clone() ServerState

func (ServerState) JoiningCount

func (s ServerState) JoiningCount() int

func (ServerState) ServingCount

func (s ServerState) ServingCount() int

func (ServerState) TotalCount

func (s ServerState) TotalCount() int

type State

type State struct {
	Serv    map[uint64]ServerState
	Part    map[uint32]PartitionState
	Replica map[replicaKey]ReplicaState
	Joining int
}

func NewState

func NewState() *State

func NextState

func NextState(config config.Partitions, curr *State) *State

func (*State) AddJoining

func (s *State) AddJoining(sid uint64, pid uint32)

func (State) AddLeaving

func (s State) AddLeaving(sid uint64, pid uint32)

func (State) AddPartition

func (s State) AddPartition(pid uint32)

func (State) AddReplica

func (s State) AddReplica(sid uint64, pid uint32, state ReplicaState)

func (State) AddServer

func (s State) AddServer(sid uint64)

func (State) AddServing

func (s State) AddServing(sid uint64, pid uint32)

func (State) Clone

func (s State) Clone() *State

func (State) GetReplica

func (s State) GetReplica(sid uint64, pid uint32) *ReplicaState

func (State) HasReplica

func (s State) HasReplica(sid uint64, pid uint32) bool

func (State) MaxImbalance

func (s State) MaxImbalance() int

func (State) PartitionCount

func (s State) PartitionCount() int

func (State) RemoveLeaving

func (s State) RemoveLeaving(sid uint64, pid uint32)

func (State) ServerCount

func (s State) ServerCount() int

func (*State) TransitionJoiningToServing

func (s *State) TransitionJoiningToServing(sid uint64, pid uint32)

func (State) TransitionServingToLeaving

func (s State) TransitionServingToLeaving(sid uint64, pid uint32)

Jump to

Keyboard shortcuts

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