shardmaster

package
v0.0.0-...-69bd5ce Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const NShards = 10

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 []string) *Clerk

func (*Clerk) Join

func (ck *Clerk) Join(gid int64, servers []string)

func (*Clerk) Leave

func (ck *Clerk) Leave(gid int64)

func (*Clerk) Move

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

func (*Clerk) Query

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

type Config

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

type JoinArgs

type JoinArgs struct {
	GID     int64    // unique replica group ID
	Servers []string // group server ports
}

type JoinReply

type JoinReply struct {
}

type LeaveArgs

type LeaveArgs struct {
	GID int64
}

type LeaveReply

type LeaveReply struct {
}

type MoveArgs

type MoveArgs struct {
	Shard int
	GID   int64
}

type MoveReply

type MoveReply struct {
}

type Op

type Op struct {
	Type OpType
	Args interface{}
}

type OpType

type OpType int
const (
	Join OpType = iota
	Leave
	Move
	Query
)

type QueryArgs

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

type QueryReply

type QueryReply struct {
	Config Config
}

type ShardMaster

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

func StartServer

func StartServer(servers []string, me int) *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) error

func (*ShardMaster) Kill

func (sm *ShardMaster) Kill()

please don't change this function.

func (*ShardMaster) Leave

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

func (*ShardMaster) Move

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

func (*ShardMaster) Query

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

func (*ShardMaster) WaitForAgreement

func (sm *ShardMaster) WaitForAgreement(seq int) interface{}

Jump to

Keyboard shortcuts

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