shardmaster

package
v0.0.0-...-e8e7e21 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK                 = "OK"
	ErrConfigNum       = "ErrConfigNum"
	ErrWrongLeader     = "ErrWrongLeader"
	ErrOpTimeout       = "ErrOpTimeout"
	ErrKVServerClosed  = "ErrKVServerClosed"
	ErrOutdatedRequest = "ErrOutdatedRequest"
	OpTimeout          = raft.ELECTIONTIMEOUT
	ClientOpWait       = raft.HEARTBEAT
	NotifyKeyFormat    = "%d_%d"
)
View Source
const Debug = 0
View Source
const NShards = 10

The number of shards.

Variables

This section is empty.

Functions

func DPrintf

func DPrintf(format string, a ...interface{}) (n int, err error)

func NewHeapGroupShard

func NewHeapGroupShard(groups map[int][]string) *heapGroupShard

Types

type BaseArgs

type BaseArgs struct {
	ClientId int64
	OpId     int64
}

type Clerk

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

func MakeClerk

func MakeClerk(servers []*labrpc.ClientEnd) *Clerk

func (*Clerk) Join

func (ck *Clerk) Join(servers map[int][]string)

func (*Clerk) Leave

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

func (*Clerk) Move

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

func (*Clerk) Query

func (ck *Clerk) Query(num int) Config

type Config

type Config struct {
	Num    int              // config number
	Shards [NShards]int     // shard -> gid
	Groups map[int][]string // gid -> servers[]
}

A configuration -- an assignment of shards to groups. Please don't change this.

type Err

type Err string

type GroupShard

type GroupShard struct {
	Index  int
	Gid    int
	Shards []int
}

type JoinArgs

type JoinArgs struct {
	BaseArgs
	Servers map[int][]string // new GID -> servers mappings
}

type JoinReply

type JoinReply struct {
	Result string
}

type LeaveArgs

type LeaveArgs struct {
	BaseArgs
	GIDs []int
}

type LeaveReply

type LeaveReply struct {
	Result string
}

type MoveArgs

type MoveArgs struct {
	BaseArgs
	Shard int
	GID   int
}

type MoveReply

type MoveReply struct {
	Result string
}

type OpInfo

type OpInfo interface {
	// contains filtered or unexported methods
}

type OpResult

type OpResult struct {
	ClientId int64
	OpId     int64
	Result   string
	Config   Config
}

type QueryArgs

type QueryArgs struct {
	BaseArgs
	Num int // desired config number
}

type QueryReply

type QueryReply struct {
	Result string
	Config Config
}

type ShardMaster

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

func StartServer

func StartServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persister) *ShardMaster

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

func (*ShardMaster) Join

func (sm *ShardMaster) Join(args *JoinArgs, reply *JoinReply)

func (*ShardMaster) Kill

func (sm *ShardMaster) Kill()

the tester calls Kill() when a ShardMaster 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 (*ShardMaster) Leave

func (sm *ShardMaster) Leave(args *LeaveArgs, reply *LeaveReply)

func (*ShardMaster) Move

func (sm *ShardMaster) Move(args *MoveArgs, reply *MoveReply)

func (*ShardMaster) Query

func (sm *ShardMaster) Query(args *QueryArgs, reply *QueryReply)

func (*ShardMaster) Raft

func (sm *ShardMaster) Raft() *raft.Raft

needed by shardkv tester

type Wait

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

func NewWait

func NewWait() *Wait

New creates a Wait.

func (*Wait) Register

func (w *Wait) Register(info OpInfo) <-chan OpResult

func (*Wait) Trigger

func (w *Wait) Trigger(result OpResult)

func (*Wait) Unregister

func (w *Wait) Unregister(info OpInfo)

Jump to

Keyboard shortcuts

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