grnet/synnefo — pull request #169 by papagian (2014-07-30 11:46:52+00:00)
Title: Apply metadata/group limits for the resources

Set a maximum metadata number per Pithos resource as well as a maximum group number per account.

More specifically:
* Introduce two new settings for Pithos: the maximum number of metadata each resource (account/container/object) can have and the maximum number of groups each account can have.
* Enforce the above limits.
* Introduce a LimitExceeded exception raised by the backend when these limits are infringed.

The affected backend methods are:
* update_account_meta
* update_container_meta
* update_object_meta
* register_object_map
* copy_object
* move_object
* update_object_hashmap
* update_account_groups

Applications, other than snf-pithos-app, that use the Pithos backend should put a special care on handling these situations.

Beside the above changes, the PR contains the following modifications:
* Raise custom 'InvalidPolicy' exception instead of the generic 'ValuerError' exception for account/container update requests which try to apply invalid policies.
* Refactor the backend implementation of the group/metadata update in order to reduce interaction with the database (perform bulk metadata/group updates).
* Add tests for asserting the above functionality.