mirror of https://github.com/docker/docs.git
Merge pull request #787 from aluzzardi/store-options-as-ptr
pkg/store: Pass Options as pointer, not value.
This commit is contained in:
commit
9d68cc0506
|
|
@ -49,7 +49,7 @@ func (s *Discovery) Initialize(uris string, heartbeat uint64) error {
|
|||
s.store, err = store.CreateStore(
|
||||
s.name, // name of the store
|
||||
addrs,
|
||||
store.Config{
|
||||
&store.Config{
|
||||
Timeout: s.heartbeat,
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package store
|
|||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
|
@ -10,11 +9,6 @@ import (
|
|||
api "github.com/hashicorp/consul/api"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrSessionUndefined is exported
|
||||
ErrSessionUndefined = errors.New("Session does not exist")
|
||||
)
|
||||
|
||||
// Consul embeds the client and watches
|
||||
type Consul struct {
|
||||
config *api.Config
|
||||
|
|
@ -35,7 +29,7 @@ type Watch struct {
|
|||
|
||||
// InitializeConsul creates a new Consul client given
|
||||
// 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.watches = make(map[string]*Watch)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ type Etcd struct {
|
|||
|
||||
// InitializeEtcd creates a new Etcd client given
|
||||
// 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.watches = make(map[string]chan<- bool)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
type WatchCallback func(kviTuple ...KVEntry)
|
||||
|
||||
// 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
|
||||
// Each store should support every call listed
|
||||
|
|
@ -87,7 +87,7 @@ func init() {
|
|||
}
|
||||
|
||||
// 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 {
|
||||
log.WithFields(log.Fields{"store": store}).Debug("Initializing store service")
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ type zookeeperLock struct {
|
|||
|
||||
// InitializeZookeeper creates a new Zookeeper client
|
||||
// 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.watches = make(map[string]<-chan zk.Event)
|
||||
s.timeout = 5 * time.Second // default timeout
|
||||
|
|
|
|||
Loading…
Reference in New Issue