func get(pathNodes []string, key string) (string, error) { path := util.MakePath(append(pathNodes, key)) response, err := client.Get(path, true, true) var value string if response != nil { value = response.Node.Value } return value, err }
/** * Creates or Updates a key/value pair depending on whether _override_ is false * or true, on a path, with a certain time-to-live. */ func writeKey(pathNodes []string, key string, value string, ttl uint64, override bool) error { var err error = nil path := util.MakePath(append(pathNodes, key)) if override { _, err = client.Set(path, value, ttl) } else { _, err = client.Create(path, value, ttl) } return err }
/** * Creates or Updates a directory depending on whether _override_ is false * or true, on a path, with a certain time-to-live. */ func writeDir(pathNodes []string, dir string, ttl uint64, override bool) error { var err error = nil path := util.MakePath(append(pathNodes, dir)) if override { _, err = client.UpdateDir(path, ttl) } else { _, err = client.CreateDir(path, ttl) } return err }
func remove(pathNodes []string, key string) error { path := util.MakePath(append(pathNodes, key)) _, err := client.Delete(path, true) return err }