shardkv

package
v0.0.0-...-6ec47af Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK            = "OK"
	ErrNoKey      = "ErrNoKey"
	ErrWrongGroup = "ErrWrongGroup"
)
View Source
const Debug = 0

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) Append

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

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) PutAppend

func (ck *Clerk) PutAppend(key string, value string, op string)

send a Put or Append request.

type Err

type Err string

type GetArgs

type GetArgs struct {
	Key string
}

type GetReply

type GetReply struct {
	Err   Err
	Value string
}

type Op

type Op struct {
}

type PutAppendArgs

type PutAppendArgs struct {
	Key   string
	Value string
	Op    string // "Put" or "Append"

}

type PutAppendReply

type PutAppendReply struct {
	Err Err
}

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) PutAppend

func (kv *ShardKV) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error

RPC handler for client Put and Append requests

func (*ShardKV) Setunreliable

func (kv *ShardKV) Setunreliable(what bool)

please do not change these two functions.

Jump to

Keyboard shortcuts

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