migrate to integer ID
This commit is contained in:
parent
ffb356182e
commit
7ff2a92118
4 changed files with 27 additions and 22 deletions
11
pool.go
11
pool.go
|
|
@ -7,7 +7,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -106,7 +105,7 @@ type poolMembers []poolMember
|
|||
func (pms poolMembers) ServerList() (sl ServerRefList) {
|
||||
for _, pm := range pms {
|
||||
sl = append(sl, &ServerRef{
|
||||
ID: strconv.Itoa(pm.ID),
|
||||
ID: pm.ID,
|
||||
Name: pm.Name,
|
||||
Node: pm.Node,
|
||||
})
|
||||
|
|
@ -133,7 +132,7 @@ func (c *PoolClient) ListMembers(ctx context.Context, name string) (sl ServerRef
|
|||
return
|
||||
}
|
||||
|
||||
func (c *PoolClient) FindServer(ctx context.Context, poolname, servername, id string) (s *ServerRef, err error) {
|
||||
func (c *PoolClient) FindServer(ctx context.Context, poolname, servername string, id int) (s *ServerRef, err error) {
|
||||
var pools []string
|
||||
if poolname != "" {
|
||||
pools = append(pools, poolname)
|
||||
|
|
@ -149,7 +148,7 @@ func (c *PoolClient) FindServer(ctx context.Context, poolname, servername, id st
|
|||
return nil, err
|
||||
}
|
||||
for _, srv := range sl {
|
||||
if id != "" && srv.ID == id {
|
||||
if id != -1 && srv.ID == id {
|
||||
srv.Pool = pool
|
||||
return srv, nil
|
||||
}
|
||||
|
|
@ -163,10 +162,10 @@ func (c *PoolClient) FindServer(ctx context.Context, poolname, servername, id st
|
|||
}
|
||||
|
||||
func (c *PoolClient) FindServerByName(ctx context.Context, poolname, servername string) (s *ServerRef, err error) {
|
||||
return c.FindServer(ctx, poolname, servername, "")
|
||||
return c.FindServer(ctx, poolname, servername, -1)
|
||||
}
|
||||
|
||||
func (c *PoolClient) FindServerByID(ctx context.Context, poolname, id string) (s *ServerRef, err error) {
|
||||
func (c *PoolClient) FindServerByID(ctx context.Context, poolname string, id int) (s *ServerRef, err error) {
|
||||
return c.FindServer(ctx, poolname, "", id)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue