update
This commit is contained in:
parent
3c026e245d
commit
0e7c1e1b0b
@ -8,6 +8,7 @@ REFERENCE_FILES=(
|
|||||||
src/labgob/test_test.go
|
src/labgob/test_test.go
|
||||||
src/labrpc/labrpc.go
|
src/labrpc/labrpc.go
|
||||||
src/labrpc/test_test.go
|
src/labrpc/test_test.go
|
||||||
|
src/models1/kv.go
|
||||||
|
|
||||||
# lab 1
|
# lab 1
|
||||||
src/mrapps/crash.go
|
src/mrapps/crash.go
|
||||||
@ -43,11 +44,9 @@ REFERENCE_FILES=(
|
|||||||
src/kvraft1/rsm/test.go
|
src/kvraft1/rsm/test.go
|
||||||
src/kvraft1/kvraft_test.go
|
src/kvraft1/kvraft_test.go
|
||||||
src/kvraft1/test.go
|
src/kvraft1/test.go
|
||||||
src/models1/kv.go
|
|
||||||
|
|
||||||
# lab 5a
|
# lab 5a
|
||||||
src/shardkv1/test.go
|
src/shardkv1/test.go
|
||||||
src/shardkv1/shardctrler/lock/lock.go
|
|
||||||
|
|
||||||
# lab 5b
|
# lab 5b
|
||||||
src/shardkv1/shardkv_test.go
|
src/shardkv1/shardkv_test.go
|
||||||
|
@ -28,7 +28,6 @@ func MakeClerk(clnt *tester.Clnt, server string) kvtest.IKVClerk {
|
|||||||
// The types of args and reply (including whether they are pointers)
|
// The types of args and reply (including whether they are pointers)
|
||||||
// must match the declared types of the RPC handler function's
|
// must match the declared types of the RPC handler function's
|
||||||
// arguments. Additionally, reply must be passed as a pointer.
|
// arguments. Additionally, reply must be passed as a pointer.
|
||||||
//
|
|
||||||
func (ck *Clerk) Get(key string) (string, rpc.Tversion, rpc.Err) {
|
func (ck *Clerk) Get(key string) (string, rpc.Tversion, rpc.Err) {
|
||||||
// You will have to modify this function.
|
// You will have to modify this function.
|
||||||
return "", 0, rpc.ErrNoKey
|
return "", 0, rpc.ErrNoKey
|
||||||
|
@ -16,7 +16,8 @@ type Lock struct {
|
|||||||
// The tester calls MakeLock() and passes in a k/v clerk; your code can
|
// The tester calls MakeLock() and passes in a k/v clerk; your code can
|
||||||
// perform a Put or Get by calling lk.ck.Put() or lk.ck.Get().
|
// perform a Put or Get by calling lk.ck.Put() or lk.ck.Get().
|
||||||
//
|
//
|
||||||
// l is the key protected by the lock to be created.
|
// Use l as the key to store the "lock state" (you would have to decide
|
||||||
|
// precisely what the lock state is).
|
||||||
func MakeLock(ck kvtest.IKVClerk, l string) *Lock {
|
func MakeLock(ck kvtest.IKVClerk, l string) *Lock {
|
||||||
lk := &Lock{ck: ck}
|
lk := &Lock{ck: ck}
|
||||||
// You may add code here
|
// You may add code here
|
||||||
|
@ -56,7 +56,9 @@ func newRfsrv(ts *Test, srv int, ends []*labrpc.ClientEnd, persister *tester.Per
|
|||||||
|
|
||||||
func (rs *rfsrv) Kill() {
|
func (rs *rfsrv) Kill() {
|
||||||
//log.Printf("rs kill %d", rs.me)
|
//log.Printf("rs kill %d", rs.me)
|
||||||
|
rs.mu.Lock()
|
||||||
rs.raft = nil // tester will call Kill() on rs.raft
|
rs.raft = nil // tester will call Kill() on rs.raft
|
||||||
|
rs.mu.Unlock()
|
||||||
if rs.persister != nil {
|
if rs.persister != nil {
|
||||||
// mimic KV server that saves its persistent state in case it
|
// mimic KV server that saves its persistent state in case it
|
||||||
// restarts.
|
// restarts.
|
||||||
|
@ -49,7 +49,9 @@ func (ts *Test) cleanup() {
|
|||||||
|
|
||||||
func (ts *Test) mksrv(ends []*labrpc.ClientEnd, grp tester.Tgid, srv int, persister *tester.Persister) []tester.IService {
|
func (ts *Test) mksrv(ends []*labrpc.ClientEnd, grp tester.Tgid, srv int, persister *tester.Persister) []tester.IService {
|
||||||
s := newRfsrv(ts, srv, ends, persister, ts.snapshot)
|
s := newRfsrv(ts, srv, ends, persister, ts.snapshot)
|
||||||
|
ts.mu.Lock()
|
||||||
ts.srvs[srv] = s
|
ts.srvs[srv] = s
|
||||||
|
ts.mu.Unlock()
|
||||||
return []tester.IService{s, s.raft}
|
return []tester.IService{s, s.raft}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user