kvpaxos

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

Documentation

Index

Constants

View Source
const (
	OK       = "OK"
	ErrNoKey = "ErrNoKey"
)
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(servers []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)

shared by Put and Append.

type Err

type Err string

type GetArgs

type GetArgs struct {
	Key string
}

type GetReply

type GetReply struct {
	Err   Err
	Value string
}

type KVPaxos

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

func StartServer

func StartServer(servers []string, me int) *KVPaxos

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

func (*KVPaxos) Get

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

func (*KVPaxos) PutAppend

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

type Op

type Op struct {
}

type PutAppendArgs

type PutAppendArgs struct {
	// You'll have to add definitions here.
	Key   string
	Value string
	Op    string // "Put" or "Append"

}

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