当前位置: 首页>>代码示例>>Golang>>正文


Golang zookeeper.Register函数代码示例

本文整理汇总了Golang中github.com/docker/libkv/store/zookeeper.Register函数的典型用法代码示例。如果您正苦于以下问题:Golang Register函数的具体用法?Golang Register怎么用?Golang Register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Register函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Init

// Init is exported
func Init() {
	// Register to libkv
	zookeeper.Register()
	consul.Register()
	etcd.Register()

	// Register to internal Swarm discovery service
	discovery.Register("zk", &Discovery{backend: store.ZK})
	discovery.Register("consul", &Discovery{backend: store.CONSUL})
	discovery.Register("etcd", &Discovery{backend: store.ETCD})
}
开发者ID:dhiltgen,项目名称:swarm,代码行数:12,代码来源:kv.go

示例2: provide

func (provider *KvProvider) provide(configurationChan chan<- configMessage) error {
	switch provider.StoreType {
	case store.CONSUL:
		consul.Register()
	case store.ETCD:
		etcd.Register()
	case store.ZK:
		zookeeper.Register()
	case store.BOLTDB:
		boltdb.Register()
	default:
		return errors.New("Invalid kv store: " + string(provider.StoreType))
	}
	kv, err := libkv.NewStore(
		provider.StoreType,
		[]string{provider.Endpoint},
		&store.Config{
			ConnectionTimeout: 30 * time.Second,
			Bucket:            "traefik",
		},
	)
	if err != nil {
		return err
	}
	if _, err := kv.List(""); err != nil {
		return err
	}
	provider.kvclient = kv
	if provider.Watch {
		stopCh := make(chan struct{})
		chanKeys, err := kv.WatchTree(provider.Prefix, stopCh)
		if err != nil {
			return err
		}
		go func() {
			for {
				<-chanKeys
				configuration := provider.loadConfig()
				if configuration != nil {
					configurationChan <- configMessage{string(provider.StoreType), configuration}
				}
				defer close(stopCh)
			}
		}()
	}
	configuration := provider.loadConfig()
	configurationChan <- configMessage{string(provider.StoreType), configuration}
	return nil
}
开发者ID:ahjdzx,项目名称:traefik,代码行数:49,代码来源:kv.go

示例3: New

func New(hosts []string, config *store.Config) (store.Store, error) {
	zookeeper.Register()

	s, err := libkv.NewStore(
		store.ZK,
		hosts,
		config,
	)
	if err != nil {
		return nil, err
	}
	return &ZookeeperStorage{
		GeneralStorage: general.New(s, string(store.ZK)),
	}, nil
}
开发者ID:JeffChien,项目名称:kvctl,代码行数:15,代码来源:zookeeper.go

示例4: Provide

// Provide allows the provider to provide configurations to traefik
// using the given configuration channel.
func (provider *Zookepper) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints []types.Constraint) error {
	provider.storeType = store.ZK
	zookeeper.Register()
	return provider.provide(configurationChan, pool, constraints)
}
开发者ID:ldez,项目名称:traefik,代码行数:7,代码来源:zk.go

示例5: init

func init() {
	etcd.Register()
	consul.Register()
	zookeeper.Register()
}
开发者ID:snowsnail,项目名称:dkron,代码行数:5,代码来源:store.go

示例6: init

func init() {
	consul.Register()
	zookeeper.Register()
	etcd.Register()
	boltdb.Register()
}
开发者ID:caoyin0727,项目名称:libdatastore,代码行数:6,代码来源:datastore.go

示例7: Provide

// Provide allows the provider to provide configurations to traefik
// using the given configuration channel.
func (provider *Zookepper) Provide(configurationChan chan<- types.ConfigMessage) error {
	provider.storeType = store.ZK
	zookeeper.Register()
	return provider.provide(configurationChan)
}
开发者ID:octoblu,项目名称:traefik,代码行数:7,代码来源:zk.go

示例8: registerKVStores

func registerKVStores() {
	consul.Register()
	zookeeper.Register()
	etcd.Register()
	boltdb.Register()
}
开发者ID:vdemeester,项目名称:libnetwork,代码行数:6,代码来源:store.go

示例9: CreateStore

// CreateStore creates the KV store
func (provider *Zookepper) CreateStore() (store.Store, error) {
	provider.storeType = store.ZK
	zookeeper.Register()
	return provider.createStore()
}
开发者ID:vdemeester,项目名称:traefik,代码行数:6,代码来源:zk.go


注:本文中的github.com/docker/libkv/store/zookeeper.Register函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。