Delete old security docs when we set security

When we set security, we now also call out to cleanup old docs, which
will find all docs with same meta group id, where a meta group is a
user/database/type name, or more simply, a meta id with the suffix
removed. We use the meta group to fetch all previous security docs and
then delete the non current docs.

Note that the winning security doc may not in fact have the newest
suffix, as we could get into a situation with conflicts where the
winning rev is not the newest, so instead of sorting by suffix and
deleting everything but the newest, we instead delete everything
besides the meta id we know is the winner. We know the winning meta id
because in the set_security update we fetch the current known winning
id and pass that along to cleanup_old_docs/1.

The meta id format has been changed slightly, to append the suffix at
the end of the user/database/type group name, so that we can just chop
off the suffix and have the group.

Also, this moves the security_meta_id function into the
cassim_metadata_cache module. The motivation for this is that we're
using the suffix now to distinguish between different database
versions, which is general to all potential metadata types, not just
security, and so we want to keep the id definitions local to the cache
so we can more easily ensure all future id formats end in the suffix.

BugzId: 29571
2 files changed
tree: 62d717c730bbd87e159d6b2b07574d9a64e67678
  1. src/
  2. .gitignore
  3. LICENSE
  4. README.md
README.md

cassim

Open Sesame