This commit is contained in:
Yun-Sheng Chang 2025-02-12 23:04:16 -05:00
parent 3c026e245d
commit 0e7c1e1b0b
5 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,7 @@ REFERENCE_FILES=(
src/labgob/test_test.go
src/labrpc/labrpc.go
src/labrpc/test_test.go
src/models1/kv.go
# lab 1
src/mrapps/crash.go
@ -43,11 +44,9 @@ REFERENCE_FILES=(
src/kvraft1/rsm/test.go
src/kvraft1/kvraft_test.go
src/kvraft1/test.go
src/models1/kv.go
# lab 5a
src/shardkv1/test.go
src/shardkv1/shardctrler/lock/lock.go
# lab 5b
src/shardkv1/shardkv_test.go

View File

@ -28,7 +28,6 @@ func MakeClerk(clnt *tester.Clnt, server string) kvtest.IKVClerk {
// The types of args and reply (including whether they are pointers)
// must match the declared types of the RPC handler function's
// arguments. Additionally, reply must be passed as a pointer.
//
func (ck *Clerk) Get(key string) (string, rpc.Tversion, rpc.Err) {
// You will have to modify this function.
return "", 0, rpc.ErrNoKey

View File

@ -16,7 +16,8 @@ type Lock struct {
// 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().
//
// 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 {
lk := &Lock{ck: ck}
// You may add code here

View File

@ -56,7 +56,9 @@ func newRfsrv(ts *Test, srv int, ends []*labrpc.ClientEnd, persister *tester.Per
func (rs *rfsrv) Kill() {
//log.Printf("rs kill %d", rs.me)
rs.mu.Lock()
rs.raft = nil // tester will call Kill() on rs.raft
rs.mu.Unlock()
if rs.persister != nil {
// mimic KV server that saves its persistent state in case it
// restarts.

View File

@ -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 {
s := newRfsrv(ts, srv, ends, persister, ts.snapshot)
ts.mu.Lock()
ts.srvs[srv] = s
ts.mu.Unlock()
return []tester.IService{s, s.raft}
}