dtnrg-3----Page:25
1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25 

Persistent Storage Interface (2)
SerializableObject interface allows a single function to define marshal / unmarshal for all DB types




int Bundle::Serialize(SerializeAction* a) {
a->process(“bundleid”, &bundleid_);
a->process(“source”, &source_);
a->process(“dest”, &dest_);
a->process(“priority”, &priority_);
a->process(“custreq”, &cust_req_);
a->process(“return_rcpt”, &return_rcpt_);
// ...
}
Adding a new DB implementation requires implementing a handful of functions for different basic types (int, string, etc)
Berkeley DB implementation packs fields into a byte array
SQL implementations generate a command to update the database, e.g. update bundles set custreq = true where bundleid = 10






PPT Version