Skip to content

Commit

Permalink
#242 Extend isLinkExist endpoint with possibility not specify address
Browse files Browse the repository at this point in the history
  • Loading branch information
hleb-albau committed Feb 11, 2019
1 parent f811148 commit a09f72f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ func (c *HttpCyberdClient) IsLinkExist(from Cid, to Cid, addr sdk.AccAddress) (r
return
}

func (c *HttpCyberdClient) IsAnyLinkExist(from Cid, to Cid) (result bool, err error) {
_, err = c.httpClient.Call("is_link_exist",
map[string]interface{}{"from": from, "to": to},
&result,
)
return
}

func (c *HttpCyberdClient) GetCurrentBandwidthCreditPrice() (float64, error) {
result := &rpc.ResultBandwidthPrice{}
_, err := c.httpClient.Call("current_bandwidth_price", map[string]interface{}{}, &result)
Expand Down
3 changes: 3 additions & 0 deletions client/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type CyberdClient interface {
// returns, if given link already exists
IsLinkExist(from Cid, to Cid, addr sdk.AccAddress) (result bool, err error)

// returns, if given link already exists
IsAnyLinkExist(from Cid, to Cid) (result bool, err error)

// get current bandwidth credits price
// price 1 is price for situation, when all users use all their bandwidth (all blocks are filled for 100%)
// if price < 1, that means blocks filled partially, thus allow more active users to do more transactions
Expand Down

0 comments on commit a09f72f

Please sign in to comment.