diskv

package
v0.0.0-...-1bd0170 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2016 License: MIT Imports: 18 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 DisKV

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

func StartServer

func StartServer(gid int64, shardmasters []string,
	servers []string, me int, dir string, restart bool) *DisKV

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[]. dir is the directory name under which this

replica should store all its files.
each replica is passed a different directory.

restart is false the very first time this server

is started, and true to indicate a re-start
after a crash or after a crash with disk loss.

func (*DisKV) Get

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

func (*DisKV) PutAppend

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

RPC handler for client Put and Append requests

func (*DisKV) Setunreliable

func (kv *DisKV) Setunreliable(what bool)

please do not change these two functions.

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
}

Jump to

Keyboard shortcuts

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