Add v2 API to list endpoints middleware

The new API adds better support for storage policies and changes the
response from a list of backend urls to a dictionary with a key
"endpoints" that's a list of of the backend urls and a new key headers
that's a dictionary of headers to send along with the backend request.
In the v2 response format for object requests, there the headers key
includes "X-Backend-Storage-Policy-Index" which indicates the storage
policy index for the endpoints returned in the response.

Change-Id: I706a5b5be8002c633fe97b2429256735800a902e
Add X-Delete-At/After support to FormPost

This change adds the ability to specify a X-Delete-At or
X-Delete-After attribute when using the FormPost middleware.

Here is an example of what you need to add to the form:

  <input type="hidden" name="x_delete_at" value="<unix-timestamp>"/>
  <input type="hidden" name="x_delete_after" value="<seconds>"/>

To be inline with the other form imput names, x-delete-at/after has
changed to x_delete_at/after.

DocImpact
Change-Id: Ib1cc0bcf1dd7d2b689f2f26d100f9bab36880c81
Closes-Bug: #1065522
lock_file race fixes

I attempted to use this function and found a few problems.

We shouldn’t unlink the file after closing it, because someone else could lock
it in between.  Switch to unlink before close.

If someone else locked the file between our open and flock, they are likely to
unlink it out from underneath us.  Then we have a lock on a file that no longer
exists.  So stat the filename after locking to make sure the inode hasn't
changed or gone away.

We probably shouldn’t unlink the file if we time out waiting for a lock.  So
move that to before the finally block.

Change-Id: Id1858c97805d3ab81c584eaee8ce0d43d34a8089
Fix a couple small things in formpost doc string

Change-Id: Idb8d4707180396662493aacbd1f125c4ca43a1ca
Merge "Add X-Delete-At/After support to FormPost"
typo tradeoff -> trade-off

Change-Id: Iad5eb611bc727991606f8a2d4dbb08dcc8fa3ddb
Merge "Add v2 API to list endpoints middleware"
Merge "typo tradeoff -> trade-off"
Merge "lock_file race fixes"
Remove duplicate conditional statement

It contains two same conditional statements to check whether the first
argurment is end with '.ring.gz'. The latter one can be covered by 'else'
clause.

Change-Id: I4b67dc330e82e793020bec4b74047062313ae11c
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
Use auth_token from keystonemiddleware

auth_token middleware in python-keystoneclient is deprecated and has
been moved to the keystonemiddleware repo.

Change-Id: Ia04aa83348e0776cb3239cb5420ee1450a990d5b
Closes-Bug: #1342274
Fix trivial typos

Fixes a few typos I have stumbled across recently.

Change-Id: Ib232924f6b23c08578c52a8dd63aaaa8789f9da7
Merge "Fix a couple small things in formpost doc string"
Merge "Fix trivial typos"
Merge "Remove duplicate conditional statement"
Reuse a cursor instead of a conn.execute for better performance

In some limited testing it was ~10% faster. Every little bit helps right?

Change-Id: Ide55b7600d625ad151daca73fbdd8684f0f9e7f8
Merge "Reuse a cursor instead of a conn.execute for better performance"
Reuse a cursor instead of a conn.execute for better performance

Basically the same thing as https://review.openstack.org/#/c/109694/
but over in the account backend.

Change-Id: I9255f3145818da3adafc16d3bcf159608a78fe51
hashes.db

A sqlite-backed index and hashing system for object server contents.

This change removes rsync replication support.  All changes to object server
contents have to go through swift (i.e. ssync), because indexes need to be
updated when the contents change.

The point of all this is that the replicator will no longer need to walk the
filesystem constantly.  Instead, all replication operations will use indexed
database queries.

It maintains compatibility with the terrible hshes.pkl hashing strategy.  For
now.  We can add things later, it's a database!

As a bonus, it also fixes that .ts file hanging around forever thing.  Because
we can just look in the database to see if there are any old .ts files.

Change-Id: Ie4aabef2fd65285648da4037bb1930202b6c8acf