The following variables should be available:
'hash_algorithm': Suggested is 'sha256'
+
'block_size': Suggested is 4MB
"""
Parameters:
'marker': Start list from the next item after 'marker'
+
'limit': Number of containers to return
"""
return []
The keys returned are all user-defined, except:
'name': The account name
+
'count': The number of containers (or 0)
+
'bytes': The total data size (or 0)
+
'modified': Last modification timestamp (overall)
+
'until_timestamp': Last modification until the timestamp provided
Raises:
Parameters:
'meta': Dictionary with metadata to update
+
'replace': Replace instead of update
Raises:
Raises:
NotAllowedError: Operation not permitted
+
ValueError: Invalid data in groups
"""
return
Raises:
NotAllowedError: Operation not permitted
+
IndexError: Account is not empty
"""
return
Parameters:
'marker': Start list from the next item after 'marker'
+
'limit': Number of containers to return
+
'shared': Only list containers with permissions set
+
Raises:
NotAllowedError: Operation not permitted
The keys returned are all user-defined, except:
'name': The container name
+
'count': The number of objects
+
'bytes': The total data size
+
'modified': Last modification timestamp (overall)
+
'until_timestamp': Last modification until the timestamp provided
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
"""
return {}
Parameters:
'meta': Dictionary with metadata to update
+
'replace': Replace instead of update
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
"""
return
The keys returned are:
'quota': The maximum bytes allowed (default is 0 - unlimited)
+
'versioning': Can be 'auto', 'manual' or 'none' (default is 'manual')
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
"""
return {}
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
+
ValueError: Invalid policy defined
"""
return
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container already exists
+
ValueError: Invalid policy defined
"""
return
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
+
IndexError: Container is not empty
"""
return
Parameters:
'prefix': List objects starting with 'prefix'
+
'delimiter': Return unique names before 'delimiter' and after 'prefix'
+
'marker': Start list from the next item after 'marker'
+
'limit': Number of objects to return
- 'virtual': If not set, the result will only include names starting\
- with 'prefix' and ending without a 'delimiter' or with\
- the first occurance of the 'delimiter' after 'prefix'.\
- If set, the result will include all names after 'prefix',\
+
+ 'virtual': If not set, the result will only include names starting
+ with 'prefix' and ending without a 'delimiter' or with
+ the first occurance of the 'delimiter' after 'prefix'.
+ If set, the result will include all names after 'prefix',
up to and including the 'delimiter' if it is found
+
'keys': Include objects that have meta with the keys in the list
+
'shared': Only list objects with permissions set
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
"""
return []
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
"""
return []
The keys returned are all user-defined, except:
'name': The object name
+
'bytes': The total data size
+
'modified': Last modification timestamp (overall)
+
'modified_by': The user that committed the object (version requested)
+
'version': The version identifier
+
'version_timestamp': The version's modification timestamp
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
+
IndexError: Version does not exist
"""
return {}
Parameters:
'meta': Dictionary with metadata to update
+
'replace': Replace instead of update
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
"""
return
def get_object_permissions(self, user, account, container, name):
- """Return the path from which this object gets its permissions from,\
+ """Return the path from which this object gets its permissions from,
along with a dictionary containing the permissions.
The keys are:
'read': The object is readable by the users/groups in the list
+
'write': The object is writable by the users/groups in the list
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
"""
return {}
Raises:
NotAllowedError: Operation not permitted
+
NameError: 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\
+
+ 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
"""
return None
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
"""
return
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
+
IndexError: Version does not exist
"""
return 0, []
Parameters:
'dest_meta': Dictionary with metadata to change
+
'replace_meta': Replace metadata instead of update
+
'permissions': Updated object permissions
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container does not exist
+
ValueError: Invalid users/groups in permissions
+
AttributeError: Can not set permissions
"""
return
Parameters:
'dest_meta': Dictionary with metadata to change from source to destination
+
'replace_meta': Replace metadata instead of update
+
'permissions': New object permissions
+
'src_version': Copy from the version provided
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
+
IndexError: Version does not exist
+
ValueError: Invalid users/groups in permissions
+
AttributeError: Can not set permissions
"""
return
Parameters:
'dest_meta': Dictionary with metadata to change from source to destination
+
'replace_meta': Replace metadata instead of update
+
'permissions': New object permissions
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
+
ValueError: Invalid users/groups in permissions
+
AttributeError: Can not set permissions
"""
return
Raises:
NotAllowedError: Operation not permitted
+
NameError: Container/object does not exist
"""
return
self.hashlen = len(emptyhash)
self.emptyhash = emptyhash
- def get_rear_block(self, blkhash, create=0):
+ def _get_rear_block(self, blkhash, create=0):
filename = hexlify(blkhash)
dir = join(self.blockpath, filename[0:2], filename[2:4], filename[4:6])
if not exists(dir):
name = join(dir, filename)
return ContextFile(name, create)
- def check_rear_block(self, blkhash):
+ def _check_rear_block(self, blkhash):
filename = hexlify(blkhash)
dir = join(self.blockpath, filename[0:2], filename[2:4], filename[4:6])
name = join(dir, filename)
missing = []
append = missing.append
for i, h in enumerate(hashes):
- if not self.check_rear_block(h):
+ if not self._check_rear_block(h):
append(i)
return missing
block = None
for h in hashes:
- with self.get_rear_block(h, 0) as rbl:
+ with self._get_rear_block(h, 0) as rbl:
if not rbl:
break
for block in rbl.sync_read_chunks(blocksize, 1, 0):
mf = None
missing = self.block_ping(hashlist)
for i in missing:
- with self.get_rear_block(hashlist[i], 1) as rbl:
+ with self._get_rear_block(hashlist[i], 1) as rbl:
rbl.sync_write(blocklist[i]) #XXX: verify?
return hashlist, missing
raise ValueError("Variable mappath '%s' is not a directory" % (mappath,))
self.mappath = mappath
- def get_rear_map(self, name, create=0):
+ def _get_rear_map(self, name, create=0):
name = join(self.mappath, hex(int(name)))
return ContextFile(name, create)
- def delete_rear_map(self, name):
+ def _delete_rear_map(self, name):
name = join(self.mappath, hex(int(name)))
try:
unlink(name)
namelen = self.namelen
hashes = ()
- with self.get_rear_map(name, 0) as rmap:
+ with self._get_rear_map(name, 0) as rmap:
if rmap:
hashes = list(rmap.sync_read_chunks(namelen, nr, blkoff))
return hashes
def map_stor(self, name, hashes=(), blkoff=0, create=1):
"""Store hashes in the given hashes map, replacing the old ones."""
namelen = self.namelen
- with self.get_rear_map(name, 1) as rmap:
+ with self._get_rear_map(name, 1) as rmap:
rmap.sync_write_chunks(namelen, blkoff, hashes, None)
# def map_copy(self, src, dst):
# """Copy a hashes map to another one, replacing it."""
-# with self.get_rear_map(src, 0) as rmap:
+# with self._get_rear_map(src, 0) as rmap:
# if rmap:
# rmap.copy_to(dst)
def map_remv(self, name):
"""Remove a hashes map. Returns true if the map was found and removed."""
- return self.delete_rear_map(name)
+ return self._delete_rear_map(name)