pkg/store: Pass Options as pointer, not value.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2015-05-13 19:00:39 -07:00
parent 4da6b2b093
commit 9d055d6bf8
5 changed files with 6 additions and 6 deletions

View File

@ -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,
},
)

View File

@ -35,7 +35,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)

View File

@ -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)

View File

@ -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")

View File

@ -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