
|
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 |