class QuotaError(Exception):
pass
+class AccountExists(NameError):
+ pass
+
+class ContainerExists(NameError):
+ pass
+
+class AccountNotEmpty(IndexError):
+ pass
+
+class ContainerNotEmpty(IndexError):
+ pass
+
+class ItemNotExists(NameError):
+ pass
+
+class VersionNotExists(IndexError):
+ pass
+
class BaseBackend(object):
"""Abstract backend class that serves as a reference for actual implementations.
"""
return []
- def get_account_meta(self, user, account, domain, until=None):
+ def get_account_meta(self, user, account, domain, until=None, include_user_defined=True):
"""Return a dictionary with the account metadata for the domain.
The keys returned are all user-defined, except:
Raises:
NotAllowedError: Operation not permitted
- IndexError: Account is not empty
+ AccountNotEmpty: Account is not empty
"""
return
- def list_containers(self, user, account, marker=None, limit=10000, shared=False, until=None):
+ def list_containers(self, user, account, marker=None, limit=10000, shared=False, until=None, public=False):
"""Return a list of container names existing under an account.
Parameters:
'shared': Only list containers with permissions set
+ 'public': Only list containers containing public objects
+
+
+ Raises:
+ NotAllowedError: Operation not permitted
+ """
+ return []
+
+ def list_container_meta(self, user, account, container, domain, until=None):
+ """Return a list with all the container's object meta keys for the domain.
Raises:
NotAllowedError: Operation not permitted
+
+ ItemNotExists: Container does not exist
"""
return []
- def get_container_meta(self, user, account, container, domain, until=None):
+ def get_container_meta(self, user, account, container, domain, until=None, include_user_defined=True):
"""Return a dictionary with the container metadata for the domain.
The keys returned are all user-defined, except:
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
"""
return {}
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
"""
return
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
"""
return {}
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
ValueError: Invalid policy defined
"""
return
- def put_container(self, user, account, container, policy={}):
+ def put_container(self, user, account, container, policy={}, delimiter=None):
"""Create a new container with the given name.
+ Parameters:
+ 'delimiter': If present deletes container contents instead of the container
+
Raises:
NotAllowedError: Operation not permitted
- NameError: Container already exists
+ ContainerExists: Container already exists
ValueError: Invalid policy defined
"""
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
- IndexError: Container is not empty
+ ContainerNotEmpty: Container is not empty
"""
return
- def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None, size_range=None):
+ def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None, size_range=None, public=False):
"""Return a list of object (name, version_id) tuples existing under a container.
Parameters:
'size_range': Include objects with byte size in (from, to).
Use None to specify unlimited
+
+ 'public': Only list public objects
+
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
"""
return []
- def list_object_meta(self, user, account, container, domain, until=None):
- """Return a list with all the container's object meta keys for the domain.
+ def list_object_meta(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, domain=None, keys=[], shared=False, until=None, size_range=None):
+ """Return a list of object metadata dicts existing under a container.
+
+ Same parameters with list_objects. Returned dicts have no user-defined
+ metadata and, if until is not None, a None 'modified' timestamp.
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
+ """
+ return []
+
+ def list_object_permissions(self, user, account, container, prefix=''):
+ """Return a list of paths that enforce permissions under a container.
+
+ Raises:
+ NotAllowedError: Operation not permitted
"""
return []
- def get_object_meta(self, user, account, container, name, domain, version=None):
+ def list_object_public(self, user, account, container, prefix=''):
+ """Return a dict mapping paths to public ids for objects that are public under a container."""
+ return {}
+
+ def get_object_meta(self, user, account, container, name, domain, version=None, include_user_defined=True):
"""Return a dictionary with the object metadata for the domain.
The keys returned are all user-defined, except:
'bytes': The total data size
+ 'type': The content type
+
'hash': The hashmap hash
'modified': Last modification timestamp (overall)
'version_timestamp': The version's modification timestamp
'uuid': A unique identifier that persists data or metadata updates and renames
+
+ 'checksum': The MD5 sum of the object (may be empty)
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
- IndexError: Version does not exist
+ VersionNotExists: Version does not exist
"""
return {}
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
"""
return ''
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
"""
return {}
def update_object_permissions(self, user, account, container, name, permissions):
- """Update the permissions associated with the object.
+ """Update (set) the permissions associated with the object.
Parameters:
- 'permissions': Dictionary with permissions to update
+ 'permissions': Dictionary with permissions to set
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
ValueError: Invalid users/groups in permissions
-
- AttributeError: Can not set permissions, as this object
- is already shared/private by another object higher
- in the hierarchy, or setting permissions here will
- invalidate other permissions deeper in the hierarchy
"""
return
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
"""
return None
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
"""
return
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
- IndexError: Version does not exist
+ VersionNotExists: Version does not exist
"""
return 0, []
- def update_object_hashmap(self, user, account, container, name, size, hashmap, domain, meta={}, replace_meta=False, permissions=None):
+ def update_object_hashmap(self, user, account, container, name, size, type, hashmap, checksum, domain, meta={}, replace_meta=False, permissions=None):
"""Create/update an object with the specified size and partial hashes and return the new version.
Parameters:
Raises:
NotAllowedError: Operation not permitted
- NameError: Container does not exist
+ ItemNotExists: Container does not exist
ValueError: Invalid users/groups in permissions
- AttributeError: Can not set permissions
-
QuotaError: Account or container quota exceeded
"""
return ''
- def copy_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta={}, replace_meta=False, permissions=None, src_version=None):
+ def update_object_checksum(self, user, account, container, name, version, checksum):
+ """Update an object's checksum."""
+ return
+
+ def copy_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, type, domain, meta={}, replace_meta=False, permissions=None, src_version=None, delimiter=None):
"""Copy an object's data and metadata and return the new version.
Parameters:
'permissions': New object permissions
'src_version': Copy from the version provided
+
+ 'delimiter': Copy objects whose path starts with src_name + delimiter
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
- IndexError: Version does not exist
+ VersionNotExists: Version does not exist
ValueError: Invalid users/groups in permissions
- AttributeError: Can not set permissions
-
QuotaError: Account or container quota exceeded
"""
return ''
- def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, domain, meta={}, replace_meta=False, permissions=None):
+ def move_object(self, user, src_account, src_container, src_name, dest_account, dest_container, dest_name, type, domain, meta={}, replace_meta=False, permissions=None, delimiter=None):
"""Move an object's data and metadata and return the new version.
Parameters:
'replace_meta': Replace metadata instead of update
'permissions': New object permissions
+
+ 'delimiter': Move objects whose path starts with src_name + delimiter
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
ValueError: Invalid users/groups in permissions
- AttributeError: Can not set permissions
-
QuotaError: Account or container quota exceeded
"""
return ''
- def delete_object(self, user, account, container, name, until=None):
+ def delete_object(self, user, account, container, name, until=None, delimiter=None):
"""Delete/purge an object.
+ Parameters:
+ 'delimiter': Delete objects whose path starting with name + delimiter
+
Raises:
NotAllowedError: Operation not permitted
- NameError: Container/object does not exist
+ ItemNotExists: Container/object does not exist
"""
return
"""Return a block's data.
Raises:
- NameError: Block does not exist
+ ItemNotExists: Block does not exist
"""
return ''