Fix assignment KVS backend to not use identity

The assignment KVS backend was using the identity API. This change
makes it so that the KVS backend does not use the identity API.

The assignment KVS backend was using the identity API to:

a) Store the user's projects.

The user's projects were also kept in the metadata. So the KVS
backend was changed to use the metadata rather than the user data.

a) Determine if the ID in the metadata was for a user or group.

The metadata for users and groups was split into separate keys.
Metadata for users is now prefixed with `metadata_user-` and
`metadata-groups-` is used for groups.

bp no-check-id

Change-Id: I5cc01d203d12b15575b72ad57aa3820d1d36d09f
Move filter_limit_query out of sql.Base

With the change to use oslo's db.sqlalchemy.sessions, the
sql.Base class isn't doing enough to justify its continued
existence.

This change is moving the filter_limit_query and related internal
members out of sql.Base to regular functions in the sql module.

Part of bp use-common-oslo-db-code

Change-Id: Ia4f05e5a81ded7e3543e16ecf93260680351f1e4
Variable 'domain_ref' referenced before assignment

Variable not declared before try...catch sentences trigger a
"Local variable 'domain_ref' referenced before assignment" error when
an exception is raised.

Co-Authored-By: David Stanek <dstanek@dstanek.com>
Change-Id: I0a63347cb316e3a5923243dd934a7fc51dbf1e13
Closes-Bug: #1274402
Rationalize the Assignment Grant Tables

Currently there are four different tables in the assignment sql
backend, one for each type of grant.  This leads to significantly
more complex code.

This patch rationalizes these four tables into a single Assignment
table, with the minimal of rework to calling functions of the
sql backend.  A subsequent patch will improve efficiency of the
calling code by taking advantage of a single Assignment table.

Blueprint: role-assignments-unified-sql

Change-Id: I7e604d718b29ad28b4d59458c7a528c01ff9804d
Implement mechanism to provide non-expiring keys in KVS

This patchset implements the ability to define non-expiring keys
for dogpile.cache backends. The non-expiring keys are relevant
in the case of drivers that can automatically remove keys after
a given time (e.g. memcache). This new non-expiring-key
functionality is currently only implemented for the provided
memcached backend.

bp: dogpile-kvs-backends
Change-Id: I7e25e0049e5b8697c5cb67272b660519c3c3305e
Convert Token Memcache backend to new KeyValueStore Impl

This patchset converts the memcache backend for tokens to the new
KeyValueStore implementation.  This implementation provides basic
configuration choices for utilizing memcache as a token backend.

The test_backend_memcache test suite has been removed, as there is
no extra functionality added on top of the KeyValueStore base
besides the basic configuration choices.  The test_backend_memcache
test suite was only used for testing token memcache backend.  The
important unicode tests have been moved into the base token test
suite and should now validate against all token backends.

Closes-Bug: #1260080
bp: dogpile-kvs-backends
Change-Id: I8f0bca409a6393176e77f7a27ba15959756da06f
Merge "Variable 'domain_ref' referenced before assignment"
Merge "Implement mechanism to provide non-expiring keys in KVS"
Merge "Fix assignment KVS backend to not use identity"
Merge "Move filter_limit_query out of sql.Base"
Merge "Convert Token Memcache backend to new KeyValueStore Impl"