VOL-1459 : Ensure data model synchronization from kv
- Introduced a new List function to force a load from persistence
- Properly create a proxy for non-keyed nodes (e.g. /adapters)
- Optimized load from persistence operation to avoid existing entries
- Fixed/Enhanced proxy unit test
Change-Id: Ib368d32c517e74410b541bb8927429d066a9cfd0
diff --git a/db/model/proxy.go b/db/model/proxy.go
index cfb2ef1..08c0359 100644
--- a/db/model/proxy.go
+++ b/db/model/proxy.go
@@ -158,6 +158,30 @@
return pathLock, controlled
}
+// List will retrieve information from the data model at the specified path location
+// A list operation will force access to persistence storage
+func (p *Proxy) List(path string, depth int, deep bool, txid string) interface{} {
+ var effectivePath string
+ if path == "/" {
+ effectivePath = p.getFullPath()
+ } else {
+ effectivePath = p.getFullPath() + path
+ }
+
+ pathLock, controlled := p.parseForControlledPath(effectivePath)
+
+ log.Debugf("Path: %s, Effective: %s, PathLock: %s", path, effectivePath, pathLock)
+
+ pac := PAC().ReservePath(effectivePath, p, pathLock)
+ defer PAC().ReleasePath(pathLock)
+ pac.SetProxy(p)
+
+ rv := pac.List(path, depth, deep, txid, controlled)
+
+ return rv
+}
+
+
// Get will retrieve information from the data model at the specified path location
func (p *Proxy) Get(path string, depth int, deep bool, txid string) interface{} {
var effectivePath string