summaryrefslogtreecommitdiff
path: root/src/cstore/cstore.cpp
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-08-13 11:18:33 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-08-13 11:18:33 -0700
commit31f5a0c0245604b891aac418b3b787556b9f6b5b (patch)
tree0013c49be169e35003a90a43670e16ca5c75a72d /src/cstore/cstore.cpp
parent8e98a22b3b62bab16bcf8dffd6df5ff00c540f59 (diff)
downloadvyatta-cfg-31f5a0c0245604b891aac418b3b787556b9f6b5b.tar.gz
vyatta-cfg-31f5a0c0245604b891aac418b3b787556b9f6b5b.zip
add API function for retrieving deleted values of a multi node.
Diffstat (limited to 'src/cstore/cstore.cpp')
-rw-r--r--src/cstore/cstore.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp
index 04e8b27..3cd0649 100644
--- a/src/cstore/cstore.cpp
+++ b/src/cstore/cstore.cpp
@@ -1085,6 +1085,35 @@ Cstore::cfgPathGetDeletedChildNodesDA(const vector<string>& path_comps,
}
}
+/* get "deleted" values of specified "multi node" during commit
+ * operation. values are returned in dvals. if specified path is not
+ * a "multi node", it's a nop.
+ *
+ * NOTE: this function does not consider the "value ordering". the "deleted"
+ * status is purely based on the presence/absence of a value.
+ */
+void
+Cstore::cfgPathGetDeletedValues(const vector<string>& path_comps,
+ vector<string>& dvals)
+{
+ vector<string> ovals;
+ vector<string> nvals;
+ if (!cfgPathGetValues(path_comps, ovals, true)
+ || !cfgPathGetValues(path_comps, nvals, false)) {
+ return;
+ }
+ map<string, bool> dmap;
+ for (size_t i = 0; i < nvals.size(); i++) {
+ dmap[nvals[i]] = true;
+ }
+ for (size_t i = 0; i < ovals.size(); i++) {
+ if (dmap.find(ovals[i]) == dmap.end()) {
+ // in active but not in working
+ dvals.push_back(ovals[i]);
+ }
+ }
+}
+
/* this is the equivalent of the listNodeStatus() from the original
* perl API. it provides the "status" ("deleted", "added", "changed",
* or "static") of each child node of specified path.