added server ref
This commit is contained in:
parent
b4a538849a
commit
78911eca56
4 changed files with 107 additions and 68 deletions
14
pool.go
14
pool.go
|
|
@ -103,9 +103,9 @@ type poolMember struct {
|
|||
|
||||
type poolMembers []poolMember
|
||||
|
||||
func (pms poolMembers) ServerList() (sl ServerList) {
|
||||
func (pms poolMembers) ServerList() (sl ServerRefList) {
|
||||
for _, pm := range pms {
|
||||
sl = append(sl, &Server{
|
||||
sl = append(sl, &ServerRef{
|
||||
ID: strconv.Itoa(pm.ID),
|
||||
Name: pm.Name,
|
||||
Node: pm.Node,
|
||||
|
|
@ -118,7 +118,7 @@ type pool struct {
|
|||
Members poolMembers `json:"members"`
|
||||
}
|
||||
|
||||
func (c *PoolClient) ListMembers(ctx context.Context, name string) (sl ServerList, err error) {
|
||||
func (c *PoolClient) ListMembers(ctx context.Context, name string) (sl ServerRefList, err error) {
|
||||
if name == "" {
|
||||
err = ErrEmptyPoolName
|
||||
return
|
||||
|
|
@ -133,7 +133,7 @@ func (c *PoolClient) ListMembers(ctx context.Context, name string) (sl ServerLis
|
|||
return
|
||||
}
|
||||
|
||||
func (c *PoolClient) FindServer(ctx context.Context, poolname, servername, id string) (s *Server, err error) {
|
||||
func (c *PoolClient) FindServer(ctx context.Context, poolname, servername, id string) (s *ServerRef, err error) {
|
||||
var pools []string
|
||||
if poolname != "" {
|
||||
pools = append(pools, poolname)
|
||||
|
|
@ -162,15 +162,15 @@ func (c *PoolClient) FindServer(ctx context.Context, poolname, servername, id st
|
|||
return nil, ErrServerNotFound
|
||||
}
|
||||
|
||||
func (c *PoolClient) FindServerByName(ctx context.Context, poolname, servername string) (s *Server, err error) {
|
||||
func (c *PoolClient) FindServerByName(ctx context.Context, poolname, servername string) (s *ServerRef, err error) {
|
||||
return c.FindServer(ctx, poolname, servername, "")
|
||||
}
|
||||
|
||||
func (c *PoolClient) FindServerByID(ctx context.Context, poolname, id string) (s *Server, err error) {
|
||||
func (c *PoolClient) FindServerByID(ctx context.Context, poolname, id string) (s *ServerRef, err error) {
|
||||
return c.FindServer(ctx, poolname, "", id)
|
||||
}
|
||||
|
||||
func (c *PoolClient) FindServerByURL(ctx context.Context, url string) (s *Server, err error) {
|
||||
func (c *PoolClient) FindServerByURL(ctx context.Context, url string) (s *ServerRef, err error) {
|
||||
pool, _, id, err := ParseURL(url)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue