Code cleanup
Completely reworked db<->linkb/attachment_db dependency code and parent linkage. Fixed bug in exists functions. Updated init code to connect to default linkbase and attachment database. Added debug code.
Fixed *_get_list_cb locking
Fixed *_ref locking
Uniformed linkbase interface to couch and replaced _all_links with _all_docs
Fixed dupin_attachment_db_ref locking