Browse Source

common -> cmn

pull/1780/head
Jae Kwon 8 years ago
parent
commit
9745f07bee
15 changed files with 42 additions and 42 deletions
  1. +2
    -2
      client/client.go
  2. +4
    -4
      client/grpc_client.go
  3. +3
    -3
      client/local_client.go
  4. +6
    -6
      client/socket_client.go
  5. +2
    -2
      cmd/counter/main.go
  6. +2
    -2
      cmd/dummy/main.go
  7. +2
    -2
      example/chain_aware/chain_aware_app.go
  8. +2
    -2
      example/dummy/dummy_test.go
  9. +2
    -2
      example/dummy/persistent_dummy.go
  10. +2
    -2
      example/example_test.go
  11. +4
    -4
      server/grpc_server.go
  12. +3
    -3
      server/server.go
  13. +4
    -4
      server/socket_server.go
  14. +2
    -2
      tests/benchmarks/parallel/parallel.go
  15. +2
    -2
      tests/benchmarks/simple/simple.go

+ 2
- 2
client/client.go View File

@ -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


+ 4
- 4
client/grpc_client.go View File

@ -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 {


+ 3
- 3
client/local_client.go View File

@ -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
}


+ 6
- 6
client/socket_client.go View File

@ -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


+ 2
- 2
cmd/counter/main.go View File

@ -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()
})


+ 2
- 2
cmd/dummy/main.go View File

@ -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()
})


+ 2
- 2
example/chain_aware/chain_aware_app.go View File

@ -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()
})


+ 2
- 2
example/dummy/dummy_test.go View File

@ -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


+ 2
- 2
example/dummy/persistent_dummy.go View File

@ -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())
}


+ 2
- 2
example/example_test.go View File

@ -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) {


+ 4
- 4
server/grpc_server.go View File

@ -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
}


+ 3
- 3
server/server.go View File

@ -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":


+ 4
- 4
server/socket_server.go View File

@ -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
}


+ 2
- 2
tests/benchmarks/parallel/parallel.go View File

@ -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())
}


+ 2
- 2
tests/benchmarks/simple/simple.go View File

@ -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())
}


Loading…
Cancel
Save