Revision 0c6ab9df snf-pithos-backend/pithos/backends/modular.py

b/snf-pithos-backend/pithos/backends/modular.py
683 683
    @debug_method
684 684
    @backend_method
685 685
    def delete_container(self, user, account, container, until=None, prefix='',
686
                         delimiter=None):
686
                         delimiter=None, listing_limit=None):
687 687
        """Delete/purge the container with the given name."""
688 688

  
689 689
        self._can_write_container(user, account, container)
......
731 731
            src_names = self._list_objects_no_limit(
732 732
                user, account, container, prefix='', delimiter=None,
733 733
                virtual=False, domain=None, keys=[], shared=False, until=None,
734
                size_range=None, all_props=True, public=False)
734
                size_range=None, all_props=True, public=False,
735
                listing_limit=listing_limit)
735 736
            paths = []
736 737
            for t in src_names:
737 738
                path = '/'.join((account, container, t[0]))
......
820 821

  
821 822
    def _list_objects_no_limit(self, user, account, container, prefix,
822 823
                               delimiter, virtual, domain, keys, shared, until,
823
                               size_range, all_props, public):
824
                               size_range, all_props, public,
825
                               listing_limit=10000):
824 826
        objects = []
825 827
        while True:
826
            marker = objects[-1] if objects else None
827
            limit = 10000
828
            marker = objects[-1][0] if objects else None
829
            limit = listing_limit
828 830
            l = self._list_objects(
829 831
                user, account, container, prefix, delimiter, marker, limit,
830 832
                virtual, domain, keys, shared, until, size_range, all_props,
......
1207 1209
                     dest_account, dest_container, dest_name, type,
1208 1210
                     dest_domain=None, dest_meta=None, replace_meta=False,
1209 1211
                     permissions=None, src_version=None, is_move=False,
1210
                     delimiter=None):
1212
                     delimiter=None, listing_limit=10000):
1211 1213

  
1212 1214
        report_size_change = not is_move
1213 1215
        dest_meta = dest_meta or {}
......
1249 1251
            src_names = self._list_objects_no_limit(
1250 1252
                user, src_account, src_container, prefix, delimiter=None,
1251 1253
                virtual=False, domain=None, keys=[], shared=False, until=None,
1252
                size_range=None, all_props=True, public=False)
1254
                size_range=None, all_props=True, public=False,
1255
                listing_limit=listing_limit)
1253 1256
            src_names.sort(key=lambda x: x[2])  # order by nodes
1254 1257
            paths = [elem[0] for elem in src_names]
1255 1258
            nodes = [elem[2] for elem in src_names]
......
1284 1287
    def copy_object(self, user, src_account, src_container, src_name,
1285 1288
                    dest_account, dest_container, dest_name, type, domain,
1286 1289
                    meta=None, replace_meta=False, permissions=None,
1287
                    src_version=None, delimiter=None):
1290
                    src_version=None, delimiter=None, listing_limit=None):
1288 1291
        """Copy an object's data and metadata."""
1289 1292

  
1290 1293
        meta = meta or {}
1291 1294
        dest_version_id = self._copy_object(
1292 1295
            user, src_account, src_container, src_name, dest_account,
1293 1296
            dest_container, dest_name, type, domain, meta, replace_meta,
1294
            permissions, src_version, False, delimiter)
1297
            permissions, src_version, False, delimiter,
1298
            listing_limit=listing_limit)
1295 1299
        return dest_version_id
1296 1300

  
1297 1301
    @debug_method
......
1299 1303
    def move_object(self, user, src_account, src_container, src_name,
1300 1304
                    dest_account, dest_container, dest_name, type, domain,
1301 1305
                    meta=None, replace_meta=False, permissions=None,
1302
                    delimiter=None):
1306
                    delimiter=None, listing_limit=None):
1303 1307
        """Move an object's data and metadata."""
1304 1308

  
1305 1309
        meta = meta or {}
......
1308 1312
        dest_version_id = self._move_object(
1309 1313
            user, src_account, src_container, src_name, dest_account,
1310 1314
            dest_container, dest_name, type, domain, meta, replace_meta,
1311
            permissions, None, delimiter=delimiter)
1315
            permissions, None, delimiter=delimiter,
1316
            listing_limit=listing_limit)
1312 1317
        return dest_version_id
1313 1318

  
1314 1319
    def _delete_object(self, user, account, container, name, until=None,
1315
                       delimiter=None, report_size_change=True):
1320
                       delimiter=None, report_size_change=True,
1321
                       listing_limit=None):
1316 1322
        if user != account:
1317 1323
            raise NotAllowedError
1318 1324

  
......
1377 1383
            src_names = self._list_objects_no_limit(
1378 1384
                user, account, container, prefix, delimiter=None,
1379 1385
                virtual=False, domain=None, keys=[], shared=False, until=None,
1380
                size_range=None, all_props=True, public=False)
1386
                size_range=None, all_props=True, public=False,
1387
                listing_limit=listing_limit)
1381 1388
            paths = []
1382 1389
            for t in src_names:
1383 1390
                path = '/'.join((account, container, t[0]))
......
1409 1416
    @debug_method
1410 1417
    @backend_method
1411 1418
    def delete_object(self, user, account, container, name, until=None,
1412
                      prefix='', delimiter=None):
1419
                      prefix='', delimiter=None, listing_limit=None):
1413 1420
        """Delete/purge an object."""
1414 1421

  
1415
        self._delete_object(user, account, container, name, until, delimiter)
1422
        self._delete_object(user, account, container, name, until, delimiter,
1423
                            listing_limit=listing_limit)
1416 1424

  
1417 1425
    @debug_method
1418 1426
    @backend_method

Also available in: Unified diff