shardkv

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK            = "OK"
	ErrNoKey      = "ErrNoKey"
	ErrWrongGroup = "ErrWrongGroup"
	ReConfigOK    = "ReConfigOK"
	Dead          = "Dead"
)
View Source
const Debug = 0
View Source
const MaxTransferRetries = 3000

Variables

This section is empty.

Functions

func DPrintf

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

Types

type Clerk

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

func MakeClerk

func MakeClerk(shardmasters []string) *Clerk

func (*Clerk) Get

func (ck *Clerk) Get(key string) string

fetch the current value for a key. returns "" if the key does not exist. keeps trying forever in the face of all other errors.

func (*Clerk) Put

func (ck *Clerk) Put(key string, value string)

func (*Clerk) PutExt

func (ck *Clerk) PutExt(key string, value string, dohash bool) string

func (*Clerk) PutHash

func (ck *Clerk) PutHash(key string, value string) string

type Err

type Err string

type GetArgs

type GetArgs struct {
	Key string
	// You'll have to add definitions here.
	ReqId     int64
	CliCfgNum int
}

type GetReply

type GetReply struct {
	Err   Err
	Value string
}

type Op

type Op struct {
	// Your definitions here.
	Type OpType
	Id   int64
	Args interface{}
}

type OpRes

type OpRes struct {
	K   string
	V   string
	Err Err
}

type OpType

type OpType int
const (
	Get OpType = iota
	Put
	ReConfig
	Sync
)

type PutArgs

type PutArgs struct {
	Key    string
	Value  string
	DoHash bool // For PutHash
	// You'll have to add definitions here.
	// Field names must start with capital letters,
	// otherwise RPC will break.
	ReqId     int64
	CliCfgNum int
}

type PutReply

type PutReply struct {
	Err           Err
	PreviousValue string // For PutHash
}

type ReConfigArgs

type ReConfigArgs struct {
	Cfg    shardmaster.Config
	Data   map[string]string
	LastRe map[int64]OpRes
}

type ShardKV

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

func StartServer

func StartServer(gid int64, shardmasters []string,
	servers []string, me int) *ShardKV

Start a shardkv server. gid is the ID of the server's replica group. shardmasters[] contains the ports of the

servers that implement the shardmaster.

servers[] contains the ports of the servers

in this replica group.

Me is the index of this server in servers[].

func (*ShardKV) Get

func (kv *ShardKV) Get(args *GetArgs, reply *GetReply) error

func (*ShardKV) HandleTransfer

func (kv *ShardKV) HandleTransfer(args *TransferArgs, reply *TransferReply) error

func (*ShardKV) Put

func (kv *ShardKV) Put(args *PutArgs, reply *PutReply) error

type TransferArgs

type TransferArgs struct {
	Shard  int
	CfgNum int
}

type TransferReply

type TransferReply struct {
	Err    Err
	Data   map[string]string
	LastRe map[int64]OpRes
}

Jump to

Keyboard shortcuts

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