diff options
Diffstat (limited to 'gluster/swift/common/DiskDir.py')
-rw-r--r-- | gluster/swift/common/DiskDir.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gluster/swift/common/DiskDir.py b/gluster/swift/common/DiskDir.py index 4f4a2ef..0bc95df 100644 --- a/gluster/swift/common/DiskDir.py +++ b/gluster/swift/common/DiskDir.py @@ -33,7 +33,7 @@ from gluster.swift.common.exceptions import FileOrDirNotFoundError, \ from gluster.swift.obj.expirer import delete_tracker_object from swift.common.constraints import MAX_META_COUNT, MAX_META_OVERALL_SIZE from swift.common.swob import HTTPBadRequest -from swift.common.utils import ThreadPool +from gluster.swift.common.utils import ThreadPool DATADIR = 'containers' @@ -399,7 +399,7 @@ class DiskDir(DiskCommon): def list_objects_iter(self, limit, marker, end_marker, prefix, delimiter, path=None, storage_policy_index=0, - out_content_type=None): + out_content_type=None, reverse=False): """ Returns tuple of name, created_at, size, content_type, etag. """ @@ -427,6 +427,9 @@ class DiskDir(DiskCommon): # No objects in container , return empty list return container_list + if marker and end_marker and reverse: + marker, end_marker = end_marker, marker + if end_marker: objects = filter_end_marker(objects, end_marker) @@ -471,6 +474,8 @@ class DiskDir(DiskCommon): container_list.append((obj, '0', 0, 'text/plain', '')) if len(container_list) >= limit: break + if reverse: + container_list.reverse() return container_list count = 0 @@ -512,7 +517,8 @@ class DiskDir(DiskCommon): count += 1 if count >= limit: break - + if reverse: + container_list.reverse() return container_list def _update_object_count(self): @@ -778,7 +784,8 @@ class DiskAccount(DiskCommon): return containers def list_containers_iter(self, limit, marker, end_marker, - prefix, delimiter, response_content_type=None): + prefix, delimiter, response_content_type=None, + reverse=False): """ Return tuple of name, object_count, bytes_used, 0(is_subdir). Used by account server. @@ -794,6 +801,9 @@ class DiskAccount(DiskCommon): # No containers in account, return empty list return account_list + if marker and end_marker and reverse: + marker, end_marker = end_marker, marker + if containers and end_marker: containers = filter_end_marker(containers, end_marker) @@ -841,6 +851,8 @@ class DiskAccount(DiskCommon): account_list.append((container, 0, 0, 0)) if len(account_list) >= limit: break + if reverse: + account_list.reverse() return account_list count = 0 @@ -866,7 +878,8 @@ class DiskAccount(DiskCommon): count += 1 if count >= limit: break - + if reverse: + account_list.reverse() return account_list def get_info(self): |