extended URL scheme
This commit is contained in:
parent
249d7c6844
commit
0994baf5b0
4 changed files with 39 additions and 18 deletions
7
node.go
7
node.go
|
|
@ -11,6 +11,7 @@ import (
|
|||
var (
|
||||
ErrNodesOffline = errors.New("one or more nodes are offline")
|
||||
ErrNodesNotSearched = errors.New("one or more nodes could not be searched")
|
||||
ErrEmptyID = errors.New("id is empty")
|
||||
)
|
||||
|
||||
type NodeStatus string
|
||||
|
|
@ -95,11 +96,15 @@ func (c *NodeClient) FindServerByName(ctx context.Context, name string) (s *Serv
|
|||
}
|
||||
|
||||
func (c *NodeClient) FindServerByID(ctx context.Context, id string) (s *Server, err error) {
|
||||
if id == "" {
|
||||
err = ErrEmptyID
|
||||
return
|
||||
}
|
||||
return c.FindServer(ctx, "", id)
|
||||
}
|
||||
|
||||
func (c *NodeClient) FindServerByURL(ctx context.Context, url string) (s *Server, err error) {
|
||||
_, id, err := ParseURL(url)
|
||||
_, _, id, err := ParseURL(url)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue