github.com/Cloud-Foundations/Dominator@v0.3.4/imageserver/client/getReplicationMaster.go (about)

     1  package client
     2  
     3  import (
     4  	"github.com/Cloud-Foundations/Dominator/lib/errors"
     5  	"github.com/Cloud-Foundations/Dominator/lib/srpc"
     6  	"github.com/Cloud-Foundations/Dominator/proto/imageserver"
     7  )
     8  
     9  func getReplicationMaster(client srpc.ClientI) (string, error) {
    10  	request := imageserver.GetReplicationMasterRequest{}
    11  	var reply imageserver.GetReplicationMasterResponse
    12  	err := client.RequestReply("ImageServer.GetReplicationMaster", request,
    13  		&reply)
    14  	if err != nil {
    15  		return "", err
    16  	}
    17  	if err := errors.New(reply.Error); err != nil {
    18  		return "", err
    19  	}
    20  	return reply.ReplicationMaster, nil
    21  }