mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 22:01:20 +00:00
rpc/client: include NetworkClient interface into Client interface (#3473)
I think it's nice when the Client interface has all the methods. If someone does not need a particular method/set of methods, she can use individual interfaces (e.g. NetworkClient, MempoolClient) or write her own interface. technically breaking Fixes #3458
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
* Go API
|
* Go API
|
||||||
- [libs/common] Remove RepeatTimer (also TimerMaker and Ticker interface)
|
- [libs/common] Remove RepeatTimer (also TimerMaker and Ticker interface)
|
||||||
|
- [rpc/client] \#3458 Include NetworkClient interface into Client interface
|
||||||
|
|
||||||
* Blockchain Protocol
|
* Blockchain Protocol
|
||||||
|
|
||||||
|
@ -52,11 +52,7 @@ func NewHTTP(remote, wsEndpoint string) *HTTP {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var _ Client = (*HTTP)(nil)
|
||||||
_ Client = (*HTTP)(nil)
|
|
||||||
_ NetworkClient = (*HTTP)(nil)
|
|
||||||
_ EventsClient = (*HTTP)(nil)
|
|
||||||
)
|
|
||||||
|
|
||||||
func (c *HTTP) Status() (*ctypes.ResultStatus, error) {
|
func (c *HTTP) Status() (*ctypes.ResultStatus, error) {
|
||||||
result := new(ctypes.ResultStatus)
|
result := new(ctypes.ResultStatus)
|
||||||
|
@ -72,17 +72,15 @@ type StatusClient interface {
|
|||||||
type Client interface {
|
type Client interface {
|
||||||
cmn.Service
|
cmn.Service
|
||||||
ABCIClient
|
ABCIClient
|
||||||
SignClient
|
|
||||||
HistoryClient
|
|
||||||
StatusClient
|
|
||||||
EventsClient
|
EventsClient
|
||||||
|
HistoryClient
|
||||||
|
NetworkClient
|
||||||
|
SignClient
|
||||||
|
StatusClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkClient is general info about the network state. May not
|
// NetworkClient is general info about the network state. May not
|
||||||
// be needed usually.
|
// be needed usually.
|
||||||
//
|
|
||||||
// Not included in the Client interface, but generally implemented
|
|
||||||
// by concrete implementations.
|
|
||||||
type NetworkClient interface {
|
type NetworkClient interface {
|
||||||
NetInfo() (*ctypes.ResultNetInfo, error)
|
NetInfo() (*ctypes.ResultNetInfo, error)
|
||||||
DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
|
DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
|
||||||
|
@ -58,11 +58,7 @@ func NewLocal(node *nm.Node) *Local {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var _ Client = (*Local)(nil)
|
||||||
_ Client = (*Local)(nil)
|
|
||||||
_ NetworkClient = (*Local)(nil)
|
|
||||||
_ EventsClient = (*Local)(nil)
|
|
||||||
)
|
|
||||||
|
|
||||||
// SetLogger allows to set a logger on the client.
|
// SetLogger allows to set a logger on the client.
|
||||||
func (c *Local) SetLogger(l log.Logger) {
|
func (c *Local) SetLogger(l log.Logger) {
|
||||||
|
@ -108,6 +108,18 @@ func (c Client) NetInfo() (*ctypes.ResultNetInfo, error) {
|
|||||||
return core.NetInfo(&rpctypes.Context{})
|
return core.NetInfo(&rpctypes.Context{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c Client) ConsensusState() (*ctypes.ResultConsensusState, error) {
|
||||||
|
return core.ConsensusState(&rpctypes.Context{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c Client) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
|
||||||
|
return core.DumpConsensusState(&rpctypes.Context{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c Client) Health() (*ctypes.ResultHealth, error) {
|
||||||
|
return core.Health(&rpctypes.Context{})
|
||||||
|
}
|
||||||
|
|
||||||
func (c Client) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
|
func (c Client) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
|
||||||
return core.UnsafeDialSeeds(&rpctypes.Context{}, seeds)
|
return core.UnsafeDialSeeds(&rpctypes.Context{}, seeds)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user