Browse files

go fmt

  • Loading branch information...
1 parent 6910733 commit 48fd070ac4dcf363b03cf527c82a6c48197010ba @bmizerany bmizerany committed Jan 27, 2012
View
3 consensus/acceptor_test.go
@@ -1,8 +1,8 @@
package consensus
import (
- _ "github.com/ha/doozerd/quiet"
"github.com/bmizerany/assert"
+ _ "github.com/ha/doozerd/quiet"
"testing"
)
@@ -80,7 +80,6 @@ func TestVotesOnlyOncePerRound(t *testing.T) {
assert.Equal(t, (*msg)(nil), got)
}
-
func TestAcceptorIgnoresBadMessages(t *testing.T) {
ac := acceptor{}
View
3 consensus/consensus.go
@@ -4,12 +4,10 @@ import (
"github.com/ha/doozerd/store"
)
-
type Proposer interface {
Propose(v []byte) store.Event
}
-
func Set(p Proposer, path string, body []byte, rev int64) (e store.Event) {
e.Mut, e.Err = store.EncodeSet(path, string(body), rev)
if e.Err != nil {
@@ -19,7 +17,6 @@ func Set(p Proposer, path string, body []byte, rev int64) (e store.Event) {
return p.Propose([]byte(e.Mut))
}
-
func Del(p Proposer, path string, rev int64) (e store.Event) {
e.Mut, e.Err = store.EncodeDel(path, rev)
if e.Err != nil {
View
2 consensus/consensus_test.go
@@ -1,9 +1,9 @@
package consensus
import (
- "github.com/ha/doozerd/store"
"errors"
"github.com/bmizerany/assert"
+ "github.com/ha/doozerd/store"
"net"
"testing"
"time"
View
1 consensus/coordinator.go
@@ -1,6 +1,5 @@
package consensus
-
type coordinator struct {
size int
quor int
View
5 consensus/coordinator_test.go
@@ -5,7 +5,6 @@ import (
"testing"
)
-
func TestCoordIgnoreOldMessages(t *testing.T) {
var co coordinator
co.size = 10
@@ -39,7 +38,6 @@ func TestCoordIgnoreOldMessages(t *testing.T) {
assert.Equal(t, false, tick)
}
-
func TestCoordStart(t *testing.T) {
co := coordinator{crnd: 1}
@@ -48,7 +46,6 @@ func TestCoordStart(t *testing.T) {
assert.Equal(t, true, tick)
}
-
func TestCoordQuorum(t *testing.T) {
co := coordinator{
size: 10,
@@ -152,7 +149,6 @@ func TestCoordRetry(t *testing.T) {
assert.Equal(t, true, tick)
}
-
func TestCoordNonTargetNomination(t *testing.T) {
co := coordinator{
quor: 6,
@@ -305,7 +301,6 @@ func TestCoordDuel(t *testing.T) {
assert.Equal(t, false, tick)
}
-
func TestCoordinatorIgnoresBadMessages(t *testing.T) {
co := coordinator{begun: true}
View
2 consensus/learner_test.go
@@ -258,7 +258,6 @@ func TestBringsOrderOutOfChaos(t *testing.T) {
assert.Equal(t, &msg{Cmd: learn, Value: []byte("foo")}, m)
}
-
func TestLearnerIgnoresBadMessages(t *testing.T) {
var ln learner
@@ -269,7 +268,6 @@ func TestLearnerIgnoresBadMessages(t *testing.T) {
assert.Equal(t, (*msg)(nil), m)
}
-
func TestSinkLearnsAValue(t *testing.T) {
var ln learner
View
2 consensus/manager_test.go
@@ -3,8 +3,8 @@ package consensus
import (
"code.google.com/p/goprotobuf/proto"
"container/heap"
- "github.com/ha/doozerd/store"
"github.com/bmizerany/assert"
+ "github.com/ha/doozerd/store"
"net"
"sort"
"testing"
View
2 consensus/run_test.go
@@ -2,8 +2,8 @@ package consensus
import (
"code.google.com/p/goprotobuf/proto"
- "github.com/ha/doozerd/store"
"github.com/bmizerany/assert"
+ "github.com/ha/doozerd/store"
"net"
"testing"
)
View
2 doozerd.go
@@ -2,11 +2,11 @@ package main
import (
"crypto/tls"
- "github.com/ha/doozerd/peer"
_ "expvar"
"flag"
"fmt"
"github.com/ha/doozer"
+ "github.com/ha/doozerd/peer"
"log"
"net"
"os"
View
2 gc/clean_test.go
@@ -1,8 +1,8 @@
package gc
import (
- "github.com/ha/doozerd/store"
"github.com/bmizerany/assert"
+ "github.com/ha/doozerd/store"
"testing"
"time"
)
View
2 gc/pulse_test.go
@@ -1,8 +1,8 @@
package gc
import (
- "github.com/ha/doozerd/store"
"github.com/bmizerany/assert"
+ "github.com/ha/doozerd/store"
"testing"
)
View
3 member/member.go
@@ -10,7 +10,6 @@ var (
calGlob = store.MustCompileGlob("/ctl/cal/*")
)
-
func Clean(c chan string, st *store.Store, p consensus.Proposer) {
for addr := range c {
_, g := st.Snap()
@@ -24,7 +23,6 @@ func Clean(c chan string, st *store.Store, p consensus.Proposer) {
}
}
-
func getName(addr string, g store.Getter) string {
for _, name := range store.Getdir(g, "/ctl/node") {
if store.GetString(g, "/ctl/node/"+name+"/addr") == addr {
@@ -34,7 +32,6 @@ func getName(addr string, g store.Getter) string {
return ""
}
-
func clearSlot(p consensus.Proposer, g store.Getter, name string) {
store.Walk(g, calGlob, func(path, body string, rev int64) bool {
if body == name {
View
6 peer/bench_test.go
@@ -1,12 +1,11 @@
package peer
import (
- "github.com/ha/doozerd/store"
"github.com/ha/doozer"
+ "github.com/ha/doozerd/store"
"testing"
)
-
func Benchmark1DoozerClientSet(b *testing.B) {
b.StopTimer()
l := mustListen()
@@ -25,7 +24,6 @@ func Benchmark1DoozerClientSet(b *testing.B) {
}
}
-
func Benchmark1DoozerConClientSet(b *testing.B) {
b.StopTimer()
l := mustListen()
@@ -51,7 +49,6 @@ func Benchmark1DoozerConClientSet(b *testing.B) {
}
}
-
func Benchmark5DoozerClientSet(b *testing.B) {
b.StopTimer()
l := mustListen()
@@ -101,7 +98,6 @@ func Benchmark5DoozerClientSet(b *testing.B) {
}
}
-
func Benchmark5DoozerConClientSet(b *testing.B) {
if b.N < 5 {
return
View
7 peer/liveness.go
@@ -1,17 +1,15 @@
package peer
import (
- "net"
"log"
+ "net"
)
-
type liverec struct {
addr *net.UDPAddr
seen int64
}
-
type liveness struct {
timeout int64
prev int64
@@ -21,7 +19,6 @@ type liveness struct {
shun chan<- string
}
-
func (lv *liveness) mark(a net.Addr, t int64) {
uaddr, ok := a.(*net.UDPAddr)
if !ok {
@@ -39,7 +36,6 @@ func (lv *liveness) mark(a net.Addr, t int64) {
}
}
-
func (lv *liveness) check(t int64) {
if t > lv.prev+lv.ival {
n := t - lv.timeout
@@ -59,7 +55,6 @@ func (lv *liveness) check(t int64) {
}
}
-
func eq(a, b *net.UDPAddr) bool {
return a.Port == b.Port && a.IP.Equal(b.IP)
}
View
5 peer/liveness_test.go
@@ -6,7 +6,6 @@ import (
"testing"
)
-
func TestLivenessMark(t *testing.T) {
a1, err := net.ResolveUDPAddr("udp", "127.0.0.1:8046")
if err != nil {
@@ -29,7 +28,6 @@ func TestLivenessMark(t *testing.T) {
assert.Equal(t, []liverec{{a1, 1}, {a2, 2}}, lv.times)
}
-
func TestLivenessStaysAlive(t *testing.T) {
shun := make(chan string, 1)
a := &net.UDPAddr{net.IP{1, 2, 3, 4}, 5}
@@ -46,7 +44,6 @@ func TestLivenessStaysAlive(t *testing.T) {
assert.Equal(t, []liverec{{a, 5}}, lv.times)
}
-
func TestLivenessTimesOut(t *testing.T) {
shun := make(chan string, 1)
a := &net.UDPAddr{net.IP{1, 2, 3, 4}, 5}
@@ -65,7 +62,6 @@ func TestLivenessTimesOut(t *testing.T) {
assert.Equal(t, []liverec{}, lv.times)
}
-
func TestLivenessSelfStaysAlive(t *testing.T) {
shun := make(chan string, 1)
a := &net.UDPAddr{net.IP{1, 2, 3, 4}, 5}
@@ -83,7 +79,6 @@ func TestLivenessSelfStaysAlive(t *testing.T) {
assert.Equal(t, []liverec{{a, 5}}, lv.times)
}
-
func TestLivenessNoCheck(t *testing.T) {
a := &net.UDPAddr{net.IP{1, 2, 3, 4}, 5}
lv := liveness{
View
5 peer/misc_test.go
@@ -1,8 +1,8 @@
package peer
import (
- _ "github.com/ha/doozerd/quiet"
"github.com/ha/doozer"
+ _ "github.com/ha/doozerd/quiet"
"net"
)
@@ -14,7 +14,6 @@ func mustListen() net.Listener {
return l
}
-
func mustListenUDP(addr string) *net.UDPConn {
uaddr, err := net.ResolveUDPAddr("udp", addr)
if err != nil {
@@ -27,7 +26,6 @@ func mustListenUDP(addr string) *net.UDPConn {
return c
}
-
func dial(addr string) *doozer.Conn {
c, err := doozer.Dial(addr)
if err != nil {
@@ -36,7 +34,6 @@ func dial(addr string) *doozer.Conn {
return c
}
-
func waitFor(cl *doozer.Conn, path string) {
var rev int64
for {
View
2 peer/peer.go
@@ -1,13 +1,13 @@
package peer
import (
+ "github.com/ha/doozer"
"github.com/ha/doozerd/consensus"
"github.com/ha/doozerd/gc"
"github.com/ha/doozerd/member"
"github.com/ha/doozerd/server"
"github.com/ha/doozerd/store"
"github.com/ha/doozerd/web"
- "github.com/ha/doozer"
"io"
"log"
"net"
View
2 peer/peer_test.go
@@ -1,9 +1,9 @@
package peer
import (
- "github.com/ha/doozerd/store"
"github.com/bmizerany/assert"
"github.com/ha/doozer"
+ "github.com/ha/doozerd/store"
"os/exec"
"testing"
View
2 server/conn.go
@@ -2,9 +2,9 @@ package server
import (
"code.google.com/p/goprotobuf/proto"
+ "encoding/binary"
"github.com/ha/doozerd/consensus"
"github.com/ha/doozerd/store"
- "encoding/binary"
"io"
"log"
"sync"
View
1 server/conn_test.go
@@ -31,7 +31,6 @@ var grantTests = []grantTest{
{&conn{rosk: "", rwsk: "b"}, "b", true, true, true},
}
-
func TestConnGrant(t *testing.T) {
for _, tst := range grantTests {
ok := tst.c.grant(tst.sk)
View
2 server/server.go
@@ -8,7 +8,6 @@ import (
"os"
)
-
// ListenAndServe listens on l, accepts network connections, and
// handles requests according to the doozer protocol.
func ListenAndServe(l net.Listener, canWrite chan bool, st *store.Store, p consensus.Proposer, rwsk, rosk string) {
@@ -37,7 +36,6 @@ func ListenAndServe(l net.Listener, canWrite chan bool, st *store.Store, p conse
}
}
-
func serve(nc net.Conn, st *store.Store, p consensus.Proposer, w bool, rwsk, rosk string) {
c := &conn{
c: nc,
View
2 server/server_test.go
@@ -3,8 +3,8 @@ package server
import (
"bytes"
"code.google.com/p/goprotobuf/proto"
- "github.com/ha/doozerd/store"
"github.com/bmizerany/assert"
+ "github.com/ha/doozerd/store"
"io"
"testing"
View
6 store/bench_test.go
@@ -4,32 +4,26 @@ import (
"testing"
)
-
func BenchmarkHist10(b *testing.B) {
benchmarkNHist(10, b)
}
-
func BenchmarkHist1e3(b *testing.B) {
benchmarkNHist(1e3, b)
}
-
func BenchmarkHist1e4(b *testing.B) {
benchmarkNHist(1e4, b)
}
-
func BenchmarkHist1e5(b *testing.B) {
benchmarkNHist(1e5, b)
}
-
func BenchmarkHist1e6(b *testing.B) {
benchmarkNHist(1e6, b)
}
-
func benchmarkNHist(n int, b *testing.B) {
b.StopTimer()
st := New()
View
1 store/node_test.go
@@ -67,7 +67,6 @@ func TestNodeApplyRevMismatch(t *testing.T) {
assert.Equal(t, Event{seqn, ErrorPath, err.Error(), rev, m, err, n}, e)
}
-
func TestNodeNotADirectory(t *testing.T) {
r, _ := emptyDir.apply(1, MustEncodeSet("/x", "a", Clobber))
m := MustEncodeSet("/x/y", "b", Clobber)
View
4 web/web.go
@@ -1,16 +1,16 @@
package web
import (
- "github.com/ha/doozerd/store"
+ "code.google.com/p/go.net/websocket"
"encoding/json"
+ "github.com/ha/doozerd/store"
"io"
"log"
"net"
"net/http"
"runtime"
"strings"
"text/template"
- "code.google.com/p/go.net/websocket"
)
var Store *store.Store

0 comments on commit 48fd070

Please sign in to comment.