mirror of https://github.com/docker/docs.git
pkg/store: Pass Options as pointer, not value.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
4da6b2b093
commit
9d055d6bf8
|
|
@ -49,7 +49,7 @@ func (s *Discovery) Initialize(uris string, heartbeat uint64) error {
|
||||||
s.store, err = store.CreateStore(
|
s.store, err = store.CreateStore(
|
||||||
s.name, // name of the store
|
s.name, // name of the store
|
||||||
addrs,
|
addrs,
|
||||||
store.Config{
|
&store.Config{
|
||||||
Timeout: s.heartbeat,
|
Timeout: s.heartbeat,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ type Watch struct {
|
||||||
|
|
||||||
// InitializeConsul creates a new Consul client given
|
// InitializeConsul creates a new Consul client given
|
||||||
// a list of endpoints and optional tls config
|
// a list of endpoints and optional tls config
|
||||||
func InitializeConsul(endpoints []string, options Config) (Store, error) {
|
func InitializeConsul(endpoints []string, options *Config) (Store, error) {
|
||||||
s := &Consul{}
|
s := &Consul{}
|
||||||
s.watches = make(map[string]*Watch)
|
s.watches = make(map[string]*Watch)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ type Etcd struct {
|
||||||
|
|
||||||
// InitializeEtcd creates a new Etcd client given
|
// InitializeEtcd creates a new Etcd client given
|
||||||
// a list of endpoints and optional tls config
|
// a list of endpoints and optional tls config
|
||||||
func InitializeEtcd(addrs []string, options Config) (Store, error) {
|
func InitializeEtcd(addrs []string, options *Config) (Store, error) {
|
||||||
s := &Etcd{}
|
s := &Etcd{}
|
||||||
s.watches = make(map[string]chan<- bool)
|
s.watches = make(map[string]chan<- bool)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
type WatchCallback func(kviTuple ...KVEntry)
|
type WatchCallback func(kviTuple ...KVEntry)
|
||||||
|
|
||||||
// Initialize creates a new Store object, initializing the client
|
// Initialize creates a new Store object, initializing the client
|
||||||
type Initialize func(addrs []string, options Config) (Store, error)
|
type Initialize func(addrs []string, options *Config) (Store, error)
|
||||||
|
|
||||||
// Store represents the backend K/V storage
|
// Store represents the backend K/V storage
|
||||||
// Each store should support every call listed
|
// Each store should support every call listed
|
||||||
|
|
@ -87,7 +87,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateStore creates a an instance of store
|
// CreateStore creates a an instance of store
|
||||||
func CreateStore(store string, addrs []string, options Config) (Store, error) {
|
func CreateStore(store string, addrs []string, options *Config) (Store, error) {
|
||||||
|
|
||||||
if init, exists := stores[store]; exists {
|
if init, exists := stores[store]; exists {
|
||||||
log.WithFields(log.Fields{"store": store}).Debug("Initializing store service")
|
log.WithFields(log.Fields{"store": store}).Debug("Initializing store service")
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ type zookeeperLock struct {
|
||||||
|
|
||||||
// InitializeZookeeper creates a new Zookeeper client
|
// InitializeZookeeper creates a new Zookeeper client
|
||||||
// given a list of endpoints and optional tls config
|
// given a list of endpoints and optional tls config
|
||||||
func InitializeZookeeper(endpoints []string, options Config) (Store, error) {
|
func InitializeZookeeper(endpoints []string, options *Config) (Store, error) {
|
||||||
s := &Zookeeper{}
|
s := &Zookeeper{}
|
||||||
s.watches = make(map[string]<-chan zk.Event)
|
s.watches = make(map[string]<-chan zk.Event)
|
||||||
s.timeout = 5 * time.Second // default timeout
|
s.timeout = 5 * time.Second // default timeout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue