This project is under development, do not use in production!
package main
import (
"fmt"
"time"
"github.com/qclaogui/kv"
)
var prefix = "/app"
var keys = []string{
"/upstream/host1",
"/upstream/host2",
}
func main() {
defer kv.Watch(prefix, keys).Stop()
time.Sleep(time.Second)
v, err := kv.GetV("/app/upstream/host1")
if err != nil {
fmt.Printf("Get error %v \n\n", err)
}
fmt.Printf("Get %v \n\n", v)
vs, err := kv.GetVs("/app/upstream/*")
if err != nil {
fmt.Printf("GetMany error %v \n\n", err)
}
fmt.Printf("%v \n\n", vs)
}
深度参考 confd 的实现。