Revision da39190b

b/snf-pithos-backend/pithos/backends/modular.py
1108 1108
        return dest_version_id
1109 1109

  
1110 1110
    @debug_method
1111
    @backend_method
1112
    def register_object_map(self, user, account, container, name, size, type,
1113
                            mapfile, checksum='', domain='pithos', meta=None,
1114
                            replace_meta=False, permissions=None):
1115
        """Register an object mapfile without providing any data.
1116

  
1117
        Lock the container path, create a node pointing to the object path,
1118
        create a version pointing to the mapfile
1119
        and issue the size change in the quotaholder.
1120

  
1121
        :param user: the user account which performs the action
1122

  
1123
        :param account: the account under which the object resides
1124

  
1125
        :param container: the container under which the object resides
1126

  
1127
        :param name: the object name
1128

  
1129
        :param size: the object size
1130

  
1131
        :param type: the object mimetype
1132

  
1133
        :param mapfile: the mapfile pointing to the object data
1134

  
1135
        :param checkcum: the md5 checksum (optional)
1136

  
1137
        :param domain: the object domain
1138

  
1139
        :param meta: a dict with custom object metadata
1140

  
1141
        :param replace_meta: replace existing metadata or not
1142

  
1143
        :param permissions: a dict with the read and write object permissions
1144

  
1145
        :returns: the new object uuid
1146

  
1147
        :raises: ItemNotExists, NotAllowedError, QuotaError
1148
        """
1149

  
1150
        meta = meta or {}
1151
        try:
1152
            self.lock_container_path = True
1153
            self.put_container(user, account, container, policy=None)
1154
        except ContainerExists:
1155
            pass
1156
        finally:
1157
            self.lock_container_path = False
1158
        dest_version_id = self._update_object_hash(
1159
            user, account, container, name, size, type, mapfile, checksum,
1160
            domain, meta, replace_meta, permissions)
1161
        return self.node.version_get_properties(dest_version_id,
1162
                                                keys=('uuid',))[0]
1163

  
1164
    @debug_method
1111 1165
    def update_object_hashmap(self, user, account, container, name, size, type,
1112 1166
                              hashmap, checksum, domain, meta=None,
1113 1167
                              replace_meta=False, permissions=None):
......
1116 1170
        for h in hashmap:
1117 1171
            if h.startswith('archip_'):
1118 1172
                raise IllegalOperationError(
1119
                    'Cannot update Archipelago Volume hashmap.')
1173
                        'Cannot update Archipelago Volume hashmap.')
1120 1174
        meta = meta or {}
1121 1175
        if size == 0:  # No such thing as an empty hashmap.
1122 1176
            hashmap = [self.put_block('')]
......
1424 1478
        logger.debug("update_block: %s %s %s", hash, len(data), offset)
1425 1479
        if hash.startswith('archip_'):
1426 1480
            raise IllegalOperationError(
1427
                'Cannot update an Archipelago Volume block.')
1481
                    'Cannot update an Archipelago Volume block.')
1428 1482
        if offset == 0 and len(data) == self.block_size:
1429 1483
            return self.put_block(data)
1430 1484
        h = self.store.block_update(self._unhexlify_hash(hash), offset, data)

Also available in: Unified diff