From 9745f07beeb2cccd9047d0e7a5bdcf230f9fef24 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Mon, 23 Jan 2017 20:26:17 -0800 Subject: [PATCH] common -> cmn --- client/client.go | 4 ++-- client/grpc_client.go | 8 ++++---- client/local_client.go | 6 +++--- client/socket_client.go | 12 ++++++------ cmd/counter/main.go | 4 ++-- cmd/dummy/main.go | 4 ++-- example/chain_aware/chain_aware_app.go | 4 ++-- example/dummy/dummy_test.go | 4 ++-- example/dummy/persistent_dummy.go | 4 ++-- example/example_test.go | 4 ++-- server/grpc_server.go | 8 ++++---- server/server.go | 6 +++--- server/socket_server.go | 8 ++++---- tests/benchmarks/parallel/parallel.go | 4 ++-- tests/benchmarks/simple/simple.go | 4 ++-- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/client/client.go b/client/client.go index dc70645e4..9b3d1a750 100644 --- a/client/client.go +++ b/client/client.go @@ -5,11 +5,11 @@ import ( "sync" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) type Client interface { - common.Service + cmn.Service SetResponseCallback(Callback) Error() error diff --git a/client/grpc_client.go b/client/grpc_client.go index ec6dcdb71..fc67b8b9c 100644 --- a/client/grpc_client.go +++ b/client/grpc_client.go @@ -10,13 +10,13 @@ import ( grpc "google.golang.org/grpc" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) // A stripped copy of the remoteClient that makes // synchronous calls using grpc type grpcClient struct { - common.BaseService + cmn.BaseService mustConnect bool client types.ABCIApplicationClient @@ -32,13 +32,13 @@ func NewGRPCClient(addr string, mustConnect bool) (*grpcClient, error) { addr: addr, mustConnect: mustConnect, } - cli.BaseService = *common.NewBaseService(nil, "grpcClient", cli) + cli.BaseService = *cmn.NewBaseService(nil, "grpcClient", cli) _, err := cli.Start() // Just start it, it's confusing for callers to remember to start. return cli, err } func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) { - return common.Connect(addr) + return cmn.Connect(addr) } func (cli *grpcClient) OnStart() error { diff --git a/client/local_client.go b/client/local_client.go index 235e3fce8..459f42233 100644 --- a/client/local_client.go +++ b/client/local_client.go @@ -4,11 +4,11 @@ import ( "sync" types "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) type localClient struct { - common.BaseService + cmn.BaseService mtx *sync.Mutex types.Application Callback @@ -22,7 +22,7 @@ func NewLocalClient(mtx *sync.Mutex, app types.Application) *localClient { mtx: mtx, Application: app, } - cli.BaseService = *common.NewBaseService(log, "localClient", cli) + cli.BaseService = *cmn.NewBaseService(log, "localClient", cli) return cli } diff --git a/client/socket_client.go b/client/socket_client.go index a0def2352..d5335d8ee 100644 --- a/client/socket_client.go +++ b/client/socket_client.go @@ -11,7 +11,7 @@ import ( "time" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) const ( @@ -27,10 +27,10 @@ const flushThrottleMS = 20 // Don't wait longer than... // the application in general is not meant to be interfaced // with concurrent callers. type socketClient struct { - common.BaseService + cmn.BaseService reqQueue chan *ReqRes - flushTimer *common.ThrottleTimer + flushTimer *cmn.ThrottleTimer mustConnect bool mtx sync.Mutex @@ -45,14 +45,14 @@ type socketClient struct { func NewSocketClient(addr string, mustConnect bool) (*socketClient, error) { cli := &socketClient{ reqQueue: make(chan *ReqRes, reqQueueSize), - flushTimer: common.NewThrottleTimer("socketClient", flushThrottleMS), + flushTimer: cmn.NewThrottleTimer("socketClient", flushThrottleMS), mustConnect: mustConnect, addr: addr, reqSent: list.New(), resCb: nil, } - cli.BaseService = *common.NewBaseService(nil, "socketClient", cli) + cli.BaseService = *cmn.NewBaseService(nil, "socketClient", cli) _, err := cli.Start() // Just start it, it's confusing for callers to remember to start. return cli, err @@ -65,7 +65,7 @@ func (cli *socketClient) OnStart() error { var conn net.Conn RETRY_LOOP: for { - conn, err = common.Connect(cli.addr) + conn, err = cmn.Connect(cli.addr) if err != nil { if cli.mustConnect { return err diff --git a/cmd/counter/main.go b/cmd/counter/main.go index c547d372e..6858fc43e 100644 --- a/cmd/counter/main.go +++ b/cmd/counter/main.go @@ -6,7 +6,7 @@ import ( "github.com/tendermint/abci/example/counter" "github.com/tendermint/abci/server" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) func main() { @@ -24,7 +24,7 @@ func main() { } // Wait forever - common.TrapSignal(func() { + cmn.TrapSignal(func() { // Cleanup srv.Stop() }) diff --git a/cmd/dummy/main.go b/cmd/dummy/main.go index 71102e1aa..b48a15c7a 100644 --- a/cmd/dummy/main.go +++ b/cmd/dummy/main.go @@ -7,7 +7,7 @@ import ( "github.com/tendermint/abci/example/dummy" "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) func main() { @@ -32,7 +32,7 @@ func main() { } // Wait forever - common.TrapSignal(func() { + cmn.TrapSignal(func() { // Cleanup srv.Stop() }) diff --git a/example/chain_aware/chain_aware_app.go b/example/chain_aware/chain_aware_app.go index a9a23375a..766f570c4 100644 --- a/example/chain_aware/chain_aware_app.go +++ b/example/chain_aware/chain_aware_app.go @@ -7,7 +7,7 @@ import ( "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) func main() { @@ -23,7 +23,7 @@ func main() { } // Wait forever - common.TrapSignal(func() { + cmn.TrapSignal(func() { // Cleanup srv.Stop() }) diff --git a/example/dummy/dummy_test.go b/example/dummy/dummy_test.go index ca1ec7f92..49dce9207 100644 --- a/example/dummy/dummy_test.go +++ b/example/dummy/dummy_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" "github.com/tendermint/go-crypto" "github.com/tendermint/go-wire" ) @@ -109,7 +109,7 @@ func TestValSetChanges(t *testing.T) { vals := make([]*types.Validator, total) for i := 0; i < total; i++ { pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(fmt.Sprintf("test%d", i))).PubKey().Bytes() - power := common.RandInt() + power := cmn.RandInt() vals[i] = &types.Validator{pubkey, uint64(power)} } // iniitalize with the first nInit diff --git a/example/dummy/persistent_dummy.go b/example/dummy/persistent_dummy.go index 40c85aea9..547fc1eb0 100644 --- a/example/dummy/persistent_dummy.go +++ b/example/dummy/persistent_dummy.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" dbm "github.com/tendermint/go-db" "github.com/tendermint/go-merkle" "github.com/tendermint/go-wire" @@ -150,7 +150,7 @@ func SaveLastBlock(db dbm.DB, lastBlock LastBlockInfo) { wire.WriteBinary(lastBlock, buf, n, err) if *err != nil { // TODO - common.PanicCrisis(*err) + cmn.PanicCrisis(*err) } db.Set(lastBlockKey, buf.Bytes()) } diff --git a/example/example_test.go b/example/example_test.go index b60fc2763..26921083a 100644 --- a/example/example_test.go +++ b/example/example_test.go @@ -17,7 +17,7 @@ import ( nilapp "github.com/tendermint/abci/example/nil" "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) func TestDummy(t *testing.T) { @@ -105,7 +105,7 @@ func testStream(t *testing.T, app types.Application) { // test grpc func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) { - return common.Connect(addr) + return cmn.Connect(addr) } func testGRPCSync(t *testing.T, app *types.GRPCApplication) { diff --git a/server/grpc_server.go b/server/grpc_server.go index 3893b20b9..944d4e42c 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -7,13 +7,13 @@ import ( "google.golang.org/grpc" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) // var maxNumberConnections = 2 type GRPCServer struct { - common.BaseService + cmn.BaseService proto string addr string @@ -23,7 +23,7 @@ type GRPCServer struct { app types.ABCIApplicationServer } -func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (common.Service, error) { +func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (cmn.Service, error) { parts := strings.SplitN(protoAddr, "://", 2) proto, addr := parts[0], parts[1] s := &GRPCServer{ @@ -32,7 +32,7 @@ func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (common.Se listener: nil, app: app, } - s.BaseService = *common.NewBaseService(nil, "ABCIServer", s) + s.BaseService = *cmn.NewBaseService(nil, "ABCIServer", s) _, err := s.Start() // Just start it return s, err } diff --git a/server/server.go b/server/server.go index 1d42e7d51..eb71b1325 100644 --- a/server/server.go +++ b/server/server.go @@ -4,11 +4,11 @@ import ( "fmt" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) -func NewServer(protoAddr, transport string, app types.Application) (common.Service, error) { - var s common.Service +func NewServer(protoAddr, transport string, app types.Application) (cmn.Service, error) { + var s cmn.Service var err error switch transport { case "socket": diff --git a/server/socket_server.go b/server/socket_server.go index 070fba8cb..76185505c 100644 --- a/server/socket_server.go +++ b/server/socket_server.go @@ -9,13 +9,13 @@ import ( "sync" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) // var maxNumberConnections = 2 type SocketServer struct { - common.BaseService + cmn.BaseService proto string addr string @@ -29,7 +29,7 @@ type SocketServer struct { app types.Application } -func NewSocketServer(protoAddr string, app types.Application) (common.Service, error) { +func NewSocketServer(protoAddr string, app types.Application) (cmn.Service, error) { parts := strings.SplitN(protoAddr, "://", 2) proto, addr := parts[0], parts[1] s := &SocketServer{ @@ -39,7 +39,7 @@ func NewSocketServer(protoAddr string, app types.Application) (common.Service, e app: app, conns: make(map[int]net.Conn), } - s.BaseService = *common.NewBaseService(nil, "ABCIServer", s) + s.BaseService = *cmn.NewBaseService(nil, "ABCIServer", s) _, err := s.Start() // Just start it return s, err } diff --git a/tests/benchmarks/parallel/parallel.go b/tests/benchmarks/parallel/parallel.go index ac8d4e9e9..f01fba4c9 100644 --- a/tests/benchmarks/parallel/parallel.go +++ b/tests/benchmarks/parallel/parallel.go @@ -6,12 +6,12 @@ import ( "log" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) func main() { - conn, err := common.Connect("unix://test.sock") + conn, err := cmn.Connect("unix://test.sock") if err != nil { log.Fatal(err.Error()) } diff --git a/tests/benchmarks/simple/simple.go b/tests/benchmarks/simple/simple.go index 75b669238..498aac341 100644 --- a/tests/benchmarks/simple/simple.go +++ b/tests/benchmarks/simple/simple.go @@ -8,12 +8,12 @@ import ( "reflect" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" + cmn "github.com/tendermint/go-common" ) func main() { - conn, err := common.Connect("unix://test.sock") + conn, err := cmn.Connect("unix://test.sock") if err != nil { log.Fatal(err.Error()) }