Move attachment code into couch_att

This is an attempt to isolate the attachment record and
some related code. This will allow seamless upgrades
over time.
Merge pull request #47 from cloudant/24518-attachment-metadata

Move attachment code into couch_att
Owner must be live

BugzID: 31712
Merge pull request #52 from cloudant/31712-owner-liveness

Owner must be live
Retry if doc is missing

The catch-all clause in remote_doc_handler is the root cause of
missing updates in replication. This occurs when we receive a
{{not_found,missing}, Rev} message instead of the expected {ok, Doc}
message, and causes us to continue blindly on, including writing a
checkpoint.

This patch changes the catch-all clause to one that handles the
missing doc case and causes a retry. Any other response will be a
function_clause which will cause a messier retry.

BugzID: 31722
Merge pull request #53 from cloudant/31722-missing-updates

Retry if doc is missing
Replace margaret with couch_stats

BugzID: 16742