func NewReplicaStatus() (*ReplicaStatus, error) { metadata, err := md.NewClientAndWait(controller.MetadataURL) if err != nil { return nil, err } self, err := metadata.GetSelfContainer() if err != nil { return nil, err } addr := controller.ReplicaAddress(self.PrimaryIp, 9502) controllerClient := client.NewControllerClient("http://controller:9501/v1") replicaClient, err := replicaClient.NewReplicaClient("http://localhost:9502/v1") if err != nil { return nil, err } return &ReplicaStatus{ controller: controllerClient, replica: replicaClient, address: addr, }, nil }
func getCli(c *cli.Context) *client.ControllerClient { url := c.GlobalString("url") return client.NewControllerClient(url) }
func NewServer() *Server { contollerClient := lclient.NewControllerClient("http://localhost:9501") return &Server{ controllerClient: contollerClient, } }