Skip to content

Commit

Permalink
Refactor rpc package
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeliu committed Mar 29, 2019
1 parent 519f53d commit 219a94a
Show file tree
Hide file tree
Showing 29 changed files with 976 additions and 1,611 deletions.
182 changes: 0 additions & 182 deletions '

This file was deleted.

3 changes: 2 additions & 1 deletion client/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/CovenantSQL/CovenantSQL/crypto/kms"
"github.com/CovenantSQL/CovenantSQL/proto"
"github.com/CovenantSQL/CovenantSQL/route"
rrpc "github.com/CovenantSQL/CovenantSQL/rpc"
rpc "github.com/CovenantSQL/CovenantSQL/rpc/mux"
"github.com/CovenantSQL/CovenantSQL/types"
"github.com/CovenantSQL/CovenantSQL/utils"
Expand Down Expand Up @@ -233,7 +234,7 @@ func initNode() (cleanupFunc func(), tempDir string, server *rpc.Server, err err
}

// init rpc
if server, err = rpc.NewServerWithService(rpc.ServiceMap{route.DHTRPCName: dht}); err != nil {
if server, err = rpc.NewServerWithService(rrpc.ServiceMap{route.DHTRPCName: dht}); err != nil {
return
}

Expand Down
15 changes: 5 additions & 10 deletions cmd/cqld/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/CovenantSQL/CovenantSQL/crypto/kms"
"github.com/CovenantSQL/CovenantSQL/proto"
"github.com/CovenantSQL/CovenantSQL/route"
rrpc "github.com/CovenantSQL/CovenantSQL/rpc"
rpc "github.com/CovenantSQL/CovenantSQL/rpc/mux"
"github.com/CovenantSQL/CovenantSQL/utils"
"github.com/CovenantSQL/CovenantSQL/utils/log"
Expand Down Expand Up @@ -163,14 +164,11 @@ func TestStartBP_CallRPC(t *testing.T) {

leaderNodeID := kms.BP.NodeID
var conn net.Conn
var RPCClient *rpc.Client

if conn, err = rpc.DialToNodeWithPool(rpc.GetSessionPoolInstance(), leaderNodeID, false); err != nil {
t.Fatal(err)
}
if RPCClient, err = rpc.InitClientConn(conn); err != nil {
if conn, err = rrpc.DialToNodeWithPool(rpc.GetSessionPoolInstance(), leaderNodeID, false); err != nil {
t.Fatal(err)
}
RPCClient := rrpc.NewClientWithConn(conn)

nodePayload := proto.NewNode()
nodePayload.InitNodeCryptoInfo(100 * time.Millisecond)
Expand Down Expand Up @@ -294,14 +292,11 @@ func BenchmarkKVServer_GetAllNodeInfo(b *testing.B) {

leaderNodeID := kms.BP.NodeID
var conn net.Conn
var RPCClient *rpc.Client

if conn, err = rpc.DialToNodeWithPool(rpc.GetSessionPoolInstance(), leaderNodeID, false); err != nil {
return
}
if RPCClient, err = rpc.InitClientConn(conn); err != nil {
if conn, err = rrpc.DialToNodeWithPool(rpc.GetSessionPoolInstance(), leaderNodeID, false); err != nil {
return
}
RPCClient := rrpc.NewClientWithConn(conn)

var reqType = "FindNeighbor"
nodePayload := proto.NewNode()
Expand Down
Loading

0 comments on commit 219a94a

Please sign in to comment.