rpc/client: split out client packages (#4628)

* rpc/client: initial split into directories

* lite2: split out test package

* rpc/client: simplify client constructurs

* updated docs

* updated changelog
This commit is contained in:
Erik Grinaker
2020-04-02 15:25:30 +02:00
committed by GitHub
parent 6c88d2ba1f
commit fdf9c7ae64
19 changed files with 159 additions and 145 deletions

View File

@@ -13,7 +13,7 @@ import (
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/cli"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
var dumpCmd = &cobra.Command{
@@ -59,7 +59,7 @@ func dumpCmdHandler(_ *cobra.Command, args []string) error {
}
}
rpc, err := rpcclient.NewHTTP(nodeRPCAddr, "/websocket")
rpc, err := rpchttp.New(nodeRPCAddr, "/websocket")
if err != nil {
return errors.Wrap(err, "failed to create new http client")
}
@@ -79,7 +79,7 @@ func dumpCmdHandler(_ *cobra.Command, args []string) error {
return nil
}
func dumpDebugData(outDir string, conf *cfg.Config, rpc *rpcclient.HTTP) {
func dumpDebugData(outDir string, conf *cfg.Config, rpc *rpchttp.HTTP) {
start := time.Now().UTC()
tmpDir, err := ioutil.TempDir(outDir, "tendermint_debug_tmp")

View File

@@ -16,7 +16,7 @@ import (
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/cli"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
var killCmd = &cobra.Command{
@@ -44,7 +44,7 @@ func killCmdHandler(cmd *cobra.Command, args []string) error {
return errors.New("invalid output file")
}
rpc, err := rpcclient.NewHTTP(nodeRPCAddr, "/websocket")
rpc, err := rpchttp.New(nodeRPCAddr, "/websocket")
if err != nil {
return errors.Wrap(err, "failed to create new http client")
}

View File

@@ -11,12 +11,12 @@ import (
"github.com/pkg/errors"
cfg "github.com/tendermint/tendermint/config"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
// dumpStatus gets node status state dump from the Tendermint RPC and writes it
// to file. It returns an error upon failure.
func dumpStatus(rpc *rpcclient.HTTP, dir, filename string) error {
func dumpStatus(rpc *rpchttp.HTTP, dir, filename string) error {
status, err := rpc.Status()
if err != nil {
return errors.Wrap(err, "failed to get node status")
@@ -27,7 +27,7 @@ func dumpStatus(rpc *rpcclient.HTTP, dir, filename string) error {
// dumpNetInfo gets network information state dump from the Tendermint RPC and
// writes it to file. It returns an error upon failure.
func dumpNetInfo(rpc *rpcclient.HTTP, dir, filename string) error {
func dumpNetInfo(rpc *rpchttp.HTTP, dir, filename string) error {
netInfo, err := rpc.NetInfo()
if err != nil {
return errors.Wrap(err, "failed to get node network information")
@@ -38,7 +38,7 @@ func dumpNetInfo(rpc *rpcclient.HTTP, dir, filename string) error {
// dumpConsensusState gets consensus state dump from the Tendermint RPC and
// writes it to file. It returns an error upon failure.
func dumpConsensusState(rpc *rpcclient.HTTP, dir, filename string) error {
func dumpConsensusState(rpc *rpchttp.HTTP, dir, filename string) error {
consDump, err := rpc.DumpConsensusState()
if err != nil {
return errors.Wrap(err, "failed to get node consensus dump")

View File

@@ -18,7 +18,7 @@ import (
lproxy "github.com/tendermint/tendermint/lite2/proxy"
lrpc "github.com/tendermint/tendermint/lite2/rpc"
dbs "github.com/tendermint/tendermint/lite2/store/db"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
)
@@ -133,7 +133,7 @@ func runProxy(cmd *cobra.Command, args []string) error {
return err
}
rpcClient, err := rpcclient.NewHTTP(primaryAddr, "/websocket")
rpcClient, err := rpchttp.New(primaryAddr, "/websocket")
if err != nil {
return errors.Wrapf(err, "http client for %s", primaryAddr)
}