lib: add diff and apply diff APIs for ovsdb_datum
authorAndy Zhou <azhou@nicira.com>
Fri, 25 Sep 2015 23:19:48 +0000 (16:19 -0700)
committerAndy Zhou <azhou@ovn.org>
Fri, 11 Dec 2015 22:22:33 +0000 (14:22 -0800)
commit1a6f1cefc0ecfc60f13b815d53666421e6e0b1a0
treeaa3a011e906858f582c3f3ae04354d2817198c31
parenta711c31730bd186e77715e8ba4057f0d32251eb4
lib: add diff and apply diff APIs for ovsdb_datum

When an OVSDB column change its value, it is more efficient to only
send what has changed, rather than sending the entire new copy.
This is analogous to software programmer send patches rather than
the entire source file.

For columns store a single element, the "diff" datum is the same
as the "new" datum.

For columns that store set or map, it is only necessary to send the
information about the elements changed (including addition or removal).
The "diff" for those types are all elements that are changed.

Those APIs are mainly used for implementing a new OVSDB server
"update2" JSON-RPC notification, which encodes modifications
of a column with the contents of those "diff"s. Later patch implements
the "update2" notification.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@ovn.org>
lib/ovsdb-data.c
lib/ovsdb-data.h
tests/ovsdb-data.at
tests/test-ovsdb.c