func (s *LBRegistrySuite) SetUpSuite(c *C) { machines := []string{"http://127.0.0.1:4001"} s.client = etcd.NewClient(machines) s.client.Delete("customkey", true) s.registry, _ = NewLBRegistry("customkey", 15) s.appRegistration = &AppRegistration{Name: "name", Host: "host", Port: 12345} s.handlerRegistration = &HandlerRegistration{ Name: "name", Host: "host", Path: "/path/to/server", Methods: []string{"PUT"}, Middlewares: []middleware.Middleware{middleware.Middleware{Type: "test", ID: "id", Spec: "hi"}}, } }
func NewEtcdBackend(nodes []string, etcdKey, consistency string) (*EtcdBackend, error) { client := etcd.NewClient(nodes) if err := client.SetConsistency(consistency); err != nil { return nil, err } b := &EtcdBackend{ nodes: nodes, etcdKey: etcdKey, consistency: consistency, client: client, cancelC: make(chan bool, 1), stopC: make(chan bool, 1), } return b, nil }
func (s *ClientSuite) SetUpSuite(c *C) { machines := []string{"http://127.0.0.1:4001"} s.etcd = etcd.NewClient(machines) s.client = NewClient("clienttest") }
func NewRegistry(config Config) *Registry { return &Registry{ etcdClient: etcd.NewClient([]string{"http://127.0.0.1:4001"}), config: config, } }
func NewClient(key string) *Client { etcd := etcd.NewClient([]string{etcdMachine}) return &Client{Key: key, etcd: etcd} }