From 52bf53742ef29d4e86ac40f4c8790c5c13b99a57 Mon Sep 17 00:00:00 2001 From: kenctrl Date: Tue, 5 Mar 2024 01:21:16 -0500 Subject: [PATCH] separate Put and Append in lab 4 kvsrv --- src/kvraft/common.go | 1 - src/kvraft/server.go | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kvraft/common.go b/src/kvraft/common.go index e5ee442..bca7ed1 100644 --- a/src/kvraft/common.go +++ b/src/kvraft/common.go @@ -12,7 +12,6 @@ type Err string type PutAppendArgs struct { Key string Value string - Op string // "Put" or "Append" // You'll have to add definitions here. // Field names must start with capital letters, // otherwise RPC will break. diff --git a/src/kvraft/server.go b/src/kvraft/server.go index 551b8ae..3baa05f 100644 --- a/src/kvraft/server.go +++ b/src/kvraft/server.go @@ -43,7 +43,11 @@ func (kv *KVServer) Get(args *GetArgs, reply *GetReply) { // unlike in lab 2, neither Put nor Append should return a value. // this is already reflected in the PutAppendReply struct. -func (kv *KVServer) PutAppend(args *PutAppendArgs, reply *PutAppendReply) { +func (kv *KVServer) Put(args *PutAppendArgs, reply *PutAppendReply) { + // Your code here. +} + +func (kv *KVServer) Append(args *PutAppendArgs, reply *PutAppendReply) { // Your code here. } @@ -82,7 +86,7 @@ func StartKVServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persiste // call labgob.Register on structures you want // Go's RPC library to marshall/unmarshall. labgob.Register(Op{}) - + kv := new(KVServer) kv.me = me kv.maxraftstate = maxraftstate