Пример #1
0
//Store persists the listener defintions in the supplied key value store
func (listenerConfig *ListenerConfig) Store(kvs kvstore.KVStore) (err error) {
	b, err := json.Marshal(listenerConfig)
	if err != nil {
		return err
	}

	key := fmt.Sprintf("listeners/%s", listenerConfig.Name)
	log.Info(fmt.Sprintf("adding %s under key %s", string(b), key))
	err = kvs.Put(key, b)
	return
}
Пример #2
0
//Store persists a backend definition using the supplied key value store
func (backendConfig *BackendConfig) Store(kvs kvstore.KVStore) error {
	b, err := json.Marshal(backendConfig)
	if err != nil {
		return err
	}

	key := fmt.Sprintf("backends/%s", backendConfig.Name)
	log.Info(fmt.Sprintf("Adding %s under key %s", string(b), key))
	err = kvs.Put(key, b)
	if err != nil {
		return err
	}

	return nil
}
Пример #3
0
//Store persists the route definition using the supplied KVS
func (routeConfig *RouteConfig) Store(kvs kvstore.KVStore) error {
	b, err := json.Marshal(routeConfig)
	if err != nil {
		return nil
	}

	key := fmt.Sprintf("routes/%s", routeConfig.Name)
	log.Info(fmt.Sprintf("adding %s under key %s", string(b), key))
	err = kvs.Put(key, b)
	if err != nil {
		return err
	}

	return nil
}