shardctl

package module
v0.0.0-...-0e97469 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrWrongLeader string = "ErrWrongLeader"
	OK             string = "OK"
)
View Source
const NShards = 1024
View Source
const RequestTimeout = 5 * 200 * time.Millisecond

Variables

This section is empty.

Functions

This section is empty.

Types

type Clerk

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

func MakeClerk

func MakeClerk(servers []pb.ShardctlClient) *Clerk

func (*Clerk) Join

func (ck *Clerk) Join(servers []*pb.Group)

func (*Clerk) Leave

func (ck *Clerk) Leave(gids []int64)

func (*Clerk) Move

func (ck *Clerk) Move(shard int64, gid int64)

func (*Clerk) Query

func (ck *Clerk) Query(num int64) *pb.Config

type ClientConfig

type ClientConfig struct {
	RequestTimeout time.Duration
	RetryIntervals []time.Duration

	// Retry infinitely when Retries <0
	Retries int
}

type Config

type Config struct {
	Num    int64
	Shards [NShards]int64
	Groups map[int64]*pb.Group
}

func NewConfig

func NewConfig(pbConfig *pb.Config) *Config

func (*Config) Gids

func (cfg *Config) Gids() []int64

func (*Config) Join

func (cfg *Config) Join(newGroups []*pb.Group)

func (*Config) Leave

func (cfg *Config) Leave(gids []int64)

func (*Config) Reshard

func (cfg *Config) Reshard()

type OpType

type OpType string

type ShardCtl

type ShardCtl struct {
	SessionMap *session.SessionMap

	AppliedIndex uint64
	// contains filtered or unexported fields
}

func StartServer

func StartServer(servers []string, me uint64, persister *raft.Persister) *ShardCtl

StartServer servers[] contains the ports of the set of servers that will cooperate via Raft to form the fault-tolerant shardctl service. "me" is the index of the current server in servers[].

func (*ShardCtl) Execute

func (sc *ShardCtl) Execute(ctx context.Context, args *pb.Args) (reply *pb.Reply, err error)

func (*ShardCtl) Kill

func (sc *ShardCtl) Kill()

Kill the tester calls Kill() when a ShardCtl instance won't be needed again. you are not required to do anything in Kill(), but it might be convenient to (for example) turn off debug output from this instance.

func (*ShardCtl) Monitor

func (sc *ShardCtl) Monitor(action func(), timeout time.Duration)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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