Commit bc1485a8 authored by Ellis Michael's avatar Ellis Michael

Factoring imports

parent 0efcbed7
package diskv package diskv
import "shardmaster" import (
import "net/rpc" "crypto/rand"
import "time" "fmt"
import "sync" "math/big"
import "fmt" "net/rpc"
import "crypto/rand" "sync"
import "math/big" "time"
"shardmaster"
)
type Clerk struct { type Clerk struct {
mu sync.Mutex // one RPC at a time mu sync.Mutex // one RPC at a time
......
package diskv package diskv
import "net" import (
import "fmt" "encoding/base32"
import "net/rpc" "encoding/gob"
import "log" "fmt"
import "time" "io/ioutil"
import "paxos" "log"
import "sync" "math/rand"
import "sync/atomic" "net"
import "os" "net/rpc"
import "syscall" "os"
import "encoding/gob" "strconv"
import "encoding/base32" "sync"
import "math/rand" "sync/atomic"
import "shardmaster" "syscall"
import "io/ioutil" "time"
import "strconv"
"paxos"
"shardmaster"
)
const Debug = 0 const Debug = 0
......
package diskv package diskv
import "testing" import (
import "shardmaster" "encoding/base64"
import "runtime" "fmt"
import "strconv" "io/ioutil"
import "strings" "log"
import "os" "math/rand"
import "os/exec" "os"
import "time" "os/exec"
import "fmt" "path/filepath"
import "sync" "runtime"
import "io/ioutil" "strconv"
import "log" "strings"
import "math/rand" "sync"
import crand "crypto/rand" "sync/atomic"
import "encoding/base64" "testing"
import "path/filepath" "time"
import "sync/atomic"
crand "crypto/rand"
"shardmaster"
)
type tServer struct { type tServer struct {
p *os.Process p *os.Process
......
package kvpaxos package kvpaxos
import "net/rpc" import (
import "crypto/rand" "crypto/rand"
import "math/big" "fmt"
"math/big"
import "fmt" "net/rpc"
)
type Clerk struct { type Clerk struct {
servers []string servers []string
......
package kvpaxos package kvpaxos
import "net" import (
import "fmt" "encoding/gob"
import "net/rpc" "fmt"
import "log" "log"
import "paxos" "math/rand"
import "sync" "net"
import "sync/atomic" "net/rpc"
import "os" "os"
import "syscall" "sync"
import "encoding/gob" "sync/atomic"
import "math/rand" "syscall"
"paxos"
)
const Debug = 0 const Debug = 0
......
package kvpaxos package kvpaxos
import "testing" import (
import "runtime" "fmt"
import "strconv" "math/rand"
import "os" "os"
import "time" "runtime"
import "fmt" "strconv"
import "math/rand" "strings"
import "strings" "sync/atomic"
import "sync/atomic" "testing"
"time"
)
func check(t *testing.T, ck *Clerk, key string, value string) { func check(t *testing.T, ck *Clerk, key string, value string) {
v := ck.Get(key) v := ck.Get(key)
......
package lockservice package lockservice
import "net/rpc" import (
import "fmt" "fmt"
"net/rpc"
)
// //
// the lockservice Clerk lives in the client // the lockservice Clerk lives in the client
......
package lockservice package lockservice
import "net" import (
import "net/rpc" "fmt"
import "log" "io"
import "sync" "log"
import "fmt" "net"
import "os" "net/rpc"
import "io" "os"
import "time" "sync"
"time"
)
type LockServer struct { type LockServer struct {
mu sync.Mutex mu sync.Mutex
......
package lockservice package lockservice
import "testing" import (
import "runtime" "fmt"
import "math/rand" "math/rand"
import "os" "os"
import "strconv" "runtime"
import "time" "strconv"
import "fmt" "testing"
"time"
)
func tl(t *testing.T, ck *Clerk, lockname string, expected bool) { func tl(t *testing.T, ck *Clerk, lockname string, expected bool) {
x := ck.Lock(lockname) x := ck.Lock(lockname)
......
...@@ -15,12 +15,14 @@ package main ...@@ -15,12 +15,14 @@ package main
// -d directory // -d directory
// -r restart // -r restart
import "time" import (
import "diskv" "diskv"
import "os" "fmt"
import "fmt" "os"
import "strconv" "runtime"
import "runtime" "strconv"
"time"
)
func usage() { func usage() {
fmt.Printf("Usage: diskvd -g gid -m master... -s server... -i my-index -d dir\n") fmt.Printf("Usage: diskvd -g gid -m master... -s server... -i my-index -d dir\n")
......
...@@ -4,9 +4,12 @@ package main ...@@ -4,9 +4,12 @@ package main
// see comments in lockd.go // see comments in lockd.go
// //
import "lockservice" import (
import "os" "fmt"
import "fmt" "os"
"lockservice"
)
func usage() { func usage() {
fmt.Printf("Usage: lockc -l|-u primaryport backupport lockname\n") fmt.Printf("Usage: lockc -l|-u primaryport backupport lockname\n")
......
...@@ -11,10 +11,13 @@ package main ...@@ -11,10 +11,13 @@ package main
// on Athena, use /tmp/myname-a and /tmp/myname-b // on Athena, use /tmp/myname-a and /tmp/myname-b
// instead of a and b. // instead of a and b.
import "time" import (
import "lockservice" "fmt"
import "os" "os"
import "fmt" "time"
"lockservice"
)
func main() { func main() {
if len(os.Args) == 4 && os.Args[1] == "-p" { if len(os.Args) == 4 && os.Args[1] == "-p" {
......
...@@ -18,9 +18,12 @@ package main ...@@ -18,9 +18,12 @@ package main
// and restart them to exercise fault tolerance. // and restart them to exercise fault tolerance.
// //
import "pbservice" import (
import "os" "fmt"
import "fmt" "os"
"pbservice"
)
func usage() { func usage() {
fmt.Printf("Usage: pbc viewport key\n") fmt.Printf("Usage: pbc viewport key\n")
......
...@@ -4,10 +4,13 @@ package main ...@@ -4,10 +4,13 @@ package main
// see directions in pbc.go // see directions in pbc.go
// //
import "time" import (
import "pbservice" "fmt"
import "os" "os"
import "fmt" "time"
"pbservice"
)
func main() { func main() {
if len(os.Args) != 3 { if len(os.Args) != 3 {
......
...@@ -4,10 +4,13 @@ package main ...@@ -4,10 +4,13 @@ package main
// see directions in pbc.go // see directions in pbc.go
// //
import "time" import (
import "viewservice" "fmt"
import "os" "os"
import "fmt" "time"
"viewservice"
)
func main() { func main() {
if len(os.Args) != 2 { if len(os.Args) != 2 {
......
package main package main
import "os" import (
import "fmt" "container/list"
import "mapreduce" "fmt"
"os"
import "container/list" "mapreduce"
)
// our simplified version of MapReduce does not supply a // our simplified version of MapReduce does not supply a
// key to the Map function, as in the paper; only a value, // key to the Map function, as in the paper; only a value,
......
package mapreduce package mapreduce
import "fmt" import (
import "net/rpc" "fmt"
"net/rpc"
)
const ( const (
Map = "Map" Map = "Map"
......
package mapreduce package mapreduce
import "fmt" import (
import "os" "bufio"
import "log" "container/list"
import "strconv" "encoding/json"
import "encoding/json" "fmt"
import "sort" "hash/fnv"
import "container/list" "log"
import "net/rpc" "net"
import "net" "net/rpc"
import "bufio" "os"
import "hash/fnv" "sort"
"strconv"
// import "os/exec" )
// A simple mapreduce library with a sequential implementation. // A simple mapreduce library with a sequential implementation.
// //
......
package mapreduce package mapreduce
import "container/list" import (
import "fmt" "container/list"
"fmt"
)
type WorkerInfo struct { type WorkerInfo struct {
address string address string
......
package mapreduce package mapreduce
import "testing" import (
import "fmt" "bufio"
import "time" "container/list"
import "container/list" "fmt"
import "strings" "log"
import "os" "os"
import "bufio" "sort"
import "log" "strconv"
import "sort" "strings"
import "strconv" "testing"
"time"
)
const ( const (
nNumber = 100000 nNumber = 100000
......
package mapreduce package mapreduce
import "fmt" import (
import "os" "container/list"
import "log" "fmt"
import "net/rpc" "log"
import "net" "net"
import "container/list" "net/rpc"
"os"
)
// Worker is a server waiting for DoJob or Shutdown RPCs // Worker is a server waiting for DoJob or Shutdown RPCs
......
...@@ -20,16 +20,17 @@ package paxos ...@@ -20,16 +20,17 @@ package paxos
// px.Min() int -- instances before this seq have been forgotten // px.Min() int -- instances before this seq have been forgotten
// //
import "net" import (
import "net/rpc" "fmt"
import "log" "log"
"math/rand"
import "os" "net"
import "syscall" "net/rpc"
import "sync" "os"
import "sync/atomic" "sync"
import "fmt" "sync/atomic"
import "math/rand" "syscall"
)
// px.Status() return values, indicating // px.Status() return values, indicating
// whether an agreement has been decided, // whether an agreement has been decided,
......
package paxos package paxos
import "testing" import (
import "runtime" "encoding/base64"
import "strconv" "fmt"
import "os" "math/rand"
import "time" "os"
import "fmt" "runtime"
import "math/rand" "strconv"
import crand "crypto/rand" "sync/atomic"
import "encoding/base64" "testing"
import "sync/atomic" "time"
crand "crypto/rand"
)
func randstring(n int) string { func randstring(n int) string {
b := make([]byte, 2*n) b := make([]byte, 2*n)
......
package pbservice package pbservice
import "viewservice" import (
import "net/rpc" "crypto/rand"
import "fmt" "fmt"
"math/big"
import "crypto/rand" "net/rpc"
import "math/big"
"viewservice"
)
type Clerk struct { type Clerk struct {
vs *viewservice.Clerk vs *viewservice.Clerk
......
package pbservice package pbservice
import "net" import (
import "fmt" "fmt"