This commit is contained in:
Lily Tsai
2021-02-15 14:06:34 -08:00
parent ff788722b7
commit b8053cc3f5
2 changed files with 16 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
echo "Usage: $0 numTrials" echo "Usage: $0 numTrials"

View File

@@ -17,9 +17,19 @@ package raft
// in the same server. // in the same server.
// //
import "sync" import (
import "sync/atomic" "bytes"
import "6.824/labrpc" "fmt"
"log"
"math/rand"
"reflect"
"sync"
"sync/atomic"
"time"
"6.824/labgob"
"6.824/labrpc"
)
// import "bytes" // import "bytes"
// import "6.824/labgob" // import "6.824/labgob"
@@ -121,7 +131,7 @@ func (rf *Raft) readPersist(data []byte) {
// //
func (rf *Raft) CondInstallSnapshot(lastIncludedTerm int, lastIncludedIndex int, snapshot []byte) bool { func (rf *Raft) CondInstallSnapshot(lastIncludedTerm int, lastIncludedIndex int, snapshot []byte) bool {
// Your code here (2C). // Your code here (2D).
return true return true
} }
@@ -131,7 +141,7 @@ func (rf *Raft) CondInstallSnapshot(lastIncludedTerm int, lastIncludedIndex int,
// service no longer needs the log through (and including) // service no longer needs the log through (and including)
// that index. Raft should now trim its log as much as possible. // that index. Raft should now trim its log as much as possible.
func (rf *Raft) Snapshot(index int, snapshot []byte) { func (rf *Raft) Snapshot(index int, snapshot []byte) {
// Your code here (2C). // Your code here (2D).
} }