summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/cstore/cstore.cpp29
-rw-r--r--src/cstore/cstore.hpp2
2 files changed, 31 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.
diff --git a/src/cstore/cstore.hpp b/src/cstore/cstore.hpp
index caf845b..492462e 100644
--- a/src/cstore/cstore.hpp
+++ b/src/cstore/cstore.hpp
@@ -183,6 +183,8 @@ public:
bool cfgPathChanged(const vector<string>& path_comps);
void cfgPathGetDeletedChildNodes(const vector<string>& path_comps,
vector<string>& cnodes);
+ void cfgPathGetDeletedValues(const vector<string>& path_comps,
+ vector<string>& dvals);
void cfgPathGetChildNodesStatus(const vector<string>& path_comps,
map<string, string>& cmap);