mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
common -> cmn
This commit is contained in:
parent
a33b75fe8b
commit
9745f07bee
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
})
|
||||
|
@ -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()
|
||||
})
|
||||
|
@ -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()
|
||||
})
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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":
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -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…
x
Reference in New Issue
Block a user