Merge lp:~notmyname/swift/end_marker into lp:~hudson-openstack/swift/trunk

Proposed by John Dickinson
Status: Merged
Approved by: Chuck Thier
Approved revision: 130
Merged at revision: 130
Proposed branch: lp:~notmyname/swift/end_marker
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 500 lines (+99/-69)
8 files modified
swift/account/reaper.py (+2/-1)
swift/account/server.py (+3/-2)
swift/common/db.py (+12/-3)
swift/common/internal_proxy.py (+8/-4)
swift/container/server.py (+3/-2)
swift/stats/log_processor.py (+2/-3)
test/unit/common/test_db.py (+62/-51)
test/unit/stats/test_log_processor.py (+7/-3)
To merge this branch: bzr merge lp:~notmyname/swift/end_marker
Reviewer Review Type Date Requested Status
Chuck Thier (community) Approve
John Dickinson Needs Resubmitting
Review via email: mp+40742@code.launchpad.net

Commit message

added end_marker query parameter for container and object listings

Description of the change

Added end_marker query parameter for container and object listings. end_marker filters on the name <= end_marker

To post a comment you must log in.
Revision history for this message
John Dickinson (notmyname) wrote :

I think "end_marker" is a good name, but better ones may be suggested. It's a lot easier to change it now.

Revision history for this message
Chuck Thier (cthier) wrote :

in swift/common/internal_proxy.py, you forgot to change marker to end_marker, and a test for that functionality would be nice :)

review: Needs Fixing
Revision history for this message
John Dickinson (notmyname) wrote :

fixed the erroneous marker to be end_marker

tests for internal_proxy would be very good, but they are not in the scope of this branch

review: Needs Resubmitting
Revision history for this message
Chuck Thier (cthier) wrote :

I get the following error when I run the unit tests:

ERROR: test_get_container_listing (test.unit.stats.test_log_processor.TestLogProcessor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cthier/swift/end_marker/test/unit/stats/test_log_processor.py", line 173, in test_get_container_listing
    result = p.get_container_listing('a', 'foo')
  File "/home/cthier/swift/end_marker/swift/stats/log_processor.py", line 162, in get_container_listing
    end_marker=end_key)
TypeError: get_container_list() got an unexpected keyword argument 'end_marker'

review: Needs Fixing
Revision history for this message
Chuck Thier (cthier) wrote :

Looks good to me now. All unit and functional tests pass.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'swift/account/reaper.py'
--- swift/account/reaper.py 2010-09-06 04:06:16 +0000
+++ swift/account/reaper.py 2010-11-17 15:38:03 +0000
@@ -224,7 +224,8 @@
224 marker = ''224 marker = ''
225 while True:225 while True:
226 containers = \226 containers = \
227 list(broker.list_containers_iter(1000, marker, None, None))227 list(broker.list_containers_iter(1000, marker, None, None,
228 None))
228 if not containers:229 if not containers:
229 break230 break
230 try:231 try:
231232
=== modified file 'swift/account/server.py'
--- swift/account/server.py 2010-11-02 18:32:18 +0000
+++ swift/account/server.py 2010-11-17 15:38:03 +0000
@@ -200,6 +200,7 @@
200 return HTTPPreconditionFailed(request=req,200 return HTTPPreconditionFailed(request=req,
201 body='Maximum limit is %d' % ACCOUNT_LISTING_LIMIT)201 body='Maximum limit is %d' % ACCOUNT_LISTING_LIMIT)
202 marker = get_param(req, 'marker', '')202 marker = get_param(req, 'marker', '')
203 end_marker = get_param(req, 'end_marker')
203 query_format = get_param(req, 'format')204 query_format = get_param(req, 'format')
204 except UnicodeDecodeError, err:205 except UnicodeDecodeError, err:
205 return HTTPBadRequest(body='parameters not utf8',206 return HTTPBadRequest(body='parameters not utf8',
@@ -210,8 +211,8 @@
210 ['text/plain', 'application/json',211 ['text/plain', 'application/json',
211 'application/xml', 'text/xml'],212 'application/xml', 'text/xml'],
212 default_match='text/plain')213 default_match='text/plain')
213 account_list = broker.list_containers_iter(limit, marker, prefix,214 account_list = broker.list_containers_iter(limit, marker, end_marker,
214 delimiter)215 prefix, delimiter)
215 if out_content_type == 'application/json':216 if out_content_type == 'application/json':
216 json_pattern = ['"name":%s', '"count":%s', '"bytes":%s']217 json_pattern = ['"name":%s', '"count":%s', '"bytes":%s']
217 json_pattern = '{' + ','.join(json_pattern) + '}'218 json_pattern = '{' + ','.join(json_pattern) + '}'
218219
=== modified file 'swift/common/db.py'
--- swift/common/db.py 2010-08-16 22:30:27 +0000
+++ swift/common/db.py 2010-11-17 15:38:03 +0000
@@ -940,8 +940,8 @@
940 rv.append(row['name'])940 rv.append(row['name'])
941 return list(set(rv))941 return list(set(rv))
942942
943 def list_objects_iter(self, limit, marker, prefix, delimiter, path=None,943 def list_objects_iter(self, limit, marker, end_marker, prefix, delimiter,
944 format=None):944 path=None, format=None):
945 """945 """
946 Get a list of objects sorted by name starting at marker onward, up946 Get a list of objects sorted by name starting at marker onward, up
947 to limit entries. Entries will begin with the prefix and will not947 to limit entries. Entries will begin with the prefix and will not
@@ -949,6 +949,7 @@
949949
950 :param limit: maximum number of entries to get950 :param limit: maximum number of entries to get
951 :param marker: marker query951 :param marker: marker query
952 :param end_marker: end marker query
952 :param prefix: prefix query953 :param prefix: prefix query
953 :param delimeter: delimeter for query954 :param delimeter: delimeter for query
954 :param path: if defined, will set the prefix and delimter based on955 :param path: if defined, will set the prefix and delimter based on
@@ -977,6 +978,9 @@
977 query = '''SELECT name, created_at, size, content_type, etag978 query = '''SELECT name, created_at, size, content_type, etag
978 FROM object WHERE'''979 FROM object WHERE'''
979 query_args = []980 query_args = []
981 if end_marker:
982 query += ' name <= ? AND'
983 query_args.append(end_marker)
980 if marker and marker >= prefix:984 if marker and marker >= prefix:
981 query += ' name > ? AND'985 query += ' name > ? AND'
982 query_args.append(marker)986 query_args.append(marker)
@@ -1440,7 +1444,8 @@
1440 rv.append(row['name'])1444 rv.append(row['name'])
1441 return list(set(rv))1445 return list(set(rv))
14421446
1443 def list_containers_iter(self, limit, marker, prefix, delimiter):1447 def list_containers_iter(self, limit, marker, end_marker, prefix,
1448 delimiter):
1444 """1449 """
1445 Get a list of containerss sorted by name starting at marker onward, up1450 Get a list of containerss sorted by name starting at marker onward, up
1446 to limit entries. Entries will begin with the prefix and will not1451 to limit entries. Entries will begin with the prefix and will not
@@ -1448,6 +1453,7 @@
14481453
1449 :param limit: maximum number of entries to get1454 :param limit: maximum number of entries to get
1450 :param marker: marker query1455 :param marker: marker query
1456 :param end_marker: end marker query
1451 :param prefix: prefix query1457 :param prefix: prefix query
1452 :param delimeter: delimeter for query1458 :param delimeter: delimeter for query
14531459
@@ -1469,6 +1475,9 @@
1469 FROM container1475 FROM container
1470 WHERE deleted = 0 AND """1476 WHERE deleted = 0 AND """
1471 query_args = []1477 query_args = []
1478 if end_marker:
1479 query += ' name <= ? AND'
1480 query_args.append(end_marker)
1472 if marker and marker >= prefix:1481 if marker and marker >= prefix:
1473 query += ' name > ? AND'1482 query += ' name > ? AND'
1474 query_args.append(marker)1483 query_args.append(marker)
14751484
=== modified file 'swift/common/internal_proxy.py'
--- swift/common/internal_proxy.py 2010-10-04 21:12:43 +0000
+++ swift/common/internal_proxy.py 2010-11-17 15:38:03 +0000
@@ -156,14 +156,16 @@
156 tries += 1156 tries += 1
157 return 200 <= resp.status_int < 300157 return 200 <= resp.status_int < 300
158158
159 def get_container_list(self, account, container, marker=None, limit=None,159 def get_container_list(self, account, container, marker=None,
160 prefix=None, delimiter=None, full_listing=True):160 end_marker=None, limit=None, prefix=None,
161 delimiter=None, full_listing=True):
161 """162 """
162 Get container listing.163 Get container listing.
163164
164 :param account: account name for the container165 :param account: account name for the container
165 :param container: container name to get the listing of166 :param container: container name to get the listing of
166 :param marker: marker query167 :param marker: marker query
168 :param end_marker: end marker query
167 :param limit: limit to query169 :param limit: limit to query
168 :param prefix: prefix query170 :param prefix: prefix query
169 :param delimeter: delimeter for query171 :param delimeter: delimeter for query
@@ -173,7 +175,7 @@
173 if full_listing:175 if full_listing:
174 rv = []176 rv = []
175 listing = self.get_container_list(account, container, marker,177 listing = self.get_container_list(account, container, marker,
176 limit, prefix, delimiter, full_listing=False)178 end_marker, limit, prefix, delimiter, full_listing=False)
177 while listing:179 while listing:
178 rv.extend(listing)180 rv.extend(listing)
179 if not delimiter:181 if not delimiter:
@@ -181,12 +183,14 @@
181 else:183 else:
182 marker = listing[-1].get('name', listing[-1].get('subdir'))184 marker = listing[-1].get('name', listing[-1].get('subdir'))
183 listing = self.get_container_list(account, container, marker,185 listing = self.get_container_list(account, container, marker,
184 limit, prefix, delimiter, full_listing=False)186 end_marker, limit, prefix, delimiter, full_listing=False)
185 return rv187 return rv
186 path = '/v1/%s/%s' % (account, container)188 path = '/v1/%s/%s' % (account, container)
187 qs = 'format=json'189 qs = 'format=json'
188 if marker:190 if marker:
189 qs += '&marker=%s' % quote(marker)191 qs += '&marker=%s' % quote(marker)
192 if end_marker:
193 qs += '&end_marker=%s' % quote(end_marker)
190 if limit:194 if limit:
191 qs += '&limit=%d' % limit195 qs += '&limit=%d' % limit
192 if prefix:196 if prefix:
193197
=== modified file 'swift/container/server.py'
--- swift/container/server.py 2010-11-02 18:32:18 +0000
+++ swift/container/server.py 2010-11-17 15:38:03 +0000
@@ -267,6 +267,7 @@
267 # delimiters can be made more flexible later267 # delimiters can be made more flexible later
268 return HTTPPreconditionFailed(body='Bad delimiter')268 return HTTPPreconditionFailed(body='Bad delimiter')
269 marker = get_param(req, 'marker', '')269 marker = get_param(req, 'marker', '')
270 end_marker = get_param(req, 'end_marker')
270 limit = CONTAINER_LISTING_LIMIT271 limit = CONTAINER_LISTING_LIMIT
271 given_limit = get_param(req, 'limit')272 given_limit = get_param(req, 'limit')
272 if given_limit and given_limit.isdigit():273 if given_limit and given_limit.isdigit():
@@ -284,8 +285,8 @@
284 ['text/plain', 'application/json',285 ['text/plain', 'application/json',
285 'application/xml', 'text/xml'],286 'application/xml', 'text/xml'],
286 default_match='text/plain')287 default_match='text/plain')
287 container_list = broker.list_objects_iter(limit, marker, prefix,288 container_list = broker.list_objects_iter(limit, marker, end_marker,
288 delimiter, path)289 prefix, delimiter, path)
289 if out_content_type == 'application/json':290 if out_content_type == 'application/json':
290 json_pattern = ['"name":%s', '"hash":"%s"', '"bytes":%s',291 json_pattern = ['"name":%s', '"hash":"%s"', '"bytes":%s',
291 '"content_type":%s, "last_modified":"%s"']292 '"content_type":%s, "last_modified":"%s"']
292293
=== modified file 'swift/stats/log_processor.py'
--- swift/stats/log_processor.py 2010-11-04 19:56:08 +0000
+++ swift/stats/log_processor.py 2010-11-17 15:38:03 +0000
@@ -158,15 +158,14 @@
158 container_listing = self.internal_proxy.get_container_list(158 container_listing = self.internal_proxy.get_container_list(
159 swift_account,159 swift_account,
160 container_name,160 container_name,
161 marker=search_key)161 marker=search_key,
162 end_marker=end_key)
162 results = []163 results = []
163 if container_listing is not None:164 if container_listing is not None:
164 if listing_filter is None:165 if listing_filter is None:
165 listing_filter = set()166 listing_filter = set()
166 for item in container_listing:167 for item in container_listing:
167 name = item['name']168 name = item['name']
168 if end_key and name > end_key:
169 break
170 if name not in listing_filter:169 if name not in listing_filter:
171 results.append(name)170 results.append(name)
172 return results171 return results
173172
=== modified file 'test/unit/common/test_db.py'
--- test/unit/common/test_db.py 2010-08-16 22:30:27 +0000
+++ test/unit/common/test_db.py 2010-11-17 15:38:03 +0000
@@ -978,52 +978,57 @@
978 normalize_timestamp(time()), 0, 'text/plain',978 normalize_timestamp(time()), 0, 'text/plain',
979 'd41d8cd98f00b204e9800998ecf8427e')979 'd41d8cd98f00b204e9800998ecf8427e')
980980
981 listing = broker.list_objects_iter(100, '', None, '')981 listing = broker.list_objects_iter(100, '', None, None, '')
982 self.assertEquals(len(listing), 100)982 self.assertEquals(len(listing), 100)
983 self.assertEquals(listing[0][0], '0/0000')983 self.assertEquals(listing[0][0], '0/0000')
984 self.assertEquals(listing[-1][0], '0/0099')984 self.assertEquals(listing[-1][0], '0/0099')
985985
986 listing = broker.list_objects_iter(100, '0/0099', None, '')986 listing = broker.list_objects_iter(100, '', '0/0050', None, '')
987 self.assertEquals(len(listing), 51)
988 self.assertEquals(listing[0][0], '0/0000')
989 self.assertEquals(listing[-1][0], '0/0050')
990
991 listing = broker.list_objects_iter(100, '0/0099', None, None, '')
987 self.assertEquals(len(listing), 100)992 self.assertEquals(len(listing), 100)
988 self.assertEquals(listing[0][0], '0/0100')993 self.assertEquals(listing[0][0], '0/0100')
989 self.assertEquals(listing[-1][0], '1/0074')994 self.assertEquals(listing[-1][0], '1/0074')
990995
991 listing = broker.list_objects_iter(55, '1/0074', None, '')996 listing = broker.list_objects_iter(55, '1/0074', None, None, '')
992 self.assertEquals(len(listing), 55)997 self.assertEquals(len(listing), 55)
993 self.assertEquals(listing[0][0], '1/0075')998 self.assertEquals(listing[0][0], '1/0075')
994 self.assertEquals(listing[-1][0], '2/0004')999 self.assertEquals(listing[-1][0], '2/0004')
9951000
996 listing = broker.list_objects_iter(10, '', '0/01', '')1001 listing = broker.list_objects_iter(10, '', None, '0/01', '')
997 self.assertEquals(len(listing), 10)1002 self.assertEquals(len(listing), 10)
998 self.assertEquals(listing[0][0], '0/0100')1003 self.assertEquals(listing[0][0], '0/0100')
999 self.assertEquals(listing[-1][0], '0/0109')1004 self.assertEquals(listing[-1][0], '0/0109')
10001005
1001 listing = broker.list_objects_iter(10, '', '0/', '/')1006 listing = broker.list_objects_iter(10, '', None, '0/', '/')
1002 self.assertEquals(len(listing), 10)1007 self.assertEquals(len(listing), 10)
1003 self.assertEquals(listing[0][0], '0/0000')1008 self.assertEquals(listing[0][0], '0/0000')
1004 self.assertEquals(listing[-1][0], '0/0009')1009 self.assertEquals(listing[-1][0], '0/0009')
10051010
1006 listing = broker.list_objects_iter(10, '', '', '/')1011 listing = broker.list_objects_iter(10, '', None, '', '/')
1007 self.assertEquals(len(listing), 4)1012 self.assertEquals(len(listing), 4)
1008 self.assertEquals([row[0] for row in listing],1013 self.assertEquals([row[0] for row in listing],
1009 ['0/', '1/', '2/', '3/'])1014 ['0/', '1/', '2/', '3/'])
10101015
1011 listing = broker.list_objects_iter(10, '2', None, '/')1016 listing = broker.list_objects_iter(10, '2', None, None, '/')
1012 self.assertEquals(len(listing), 2)1017 self.assertEquals(len(listing), 2)
1013 self.assertEquals([row[0] for row in listing], ['2/', '3/'])1018 self.assertEquals([row[0] for row in listing], ['2/', '3/'])
10141019
1015 listing = broker.list_objects_iter(10, '2/', None, '/')1020 listing = broker.list_objects_iter(10, '2/',None, None, '/')
1016 self.assertEquals(len(listing), 1)1021 self.assertEquals(len(listing), 1)
1017 self.assertEquals([row[0] for row in listing], ['3/'])1022 self.assertEquals([row[0] for row in listing], ['3/'])
10181023
1019 listing = broker.list_objects_iter(10, '2/0050', '2/', '/')1024 listing = broker.list_objects_iter(10, '2/0050', None, '2/', '/')
1020 self.assertEquals(len(listing), 10)1025 self.assertEquals(len(listing), 10)
1021 self.assertEquals(listing[0][0], '2/0051')1026 self.assertEquals(listing[0][0], '2/0051')
1022 self.assertEquals(listing[1][0], '2/0051/')1027 self.assertEquals(listing[1][0], '2/0051/')
1023 self.assertEquals(listing[2][0], '2/0052')1028 self.assertEquals(listing[2][0], '2/0052')
1024 self.assertEquals(listing[-1][0], '2/0059')1029 self.assertEquals(listing[-1][0], '2/0059')
10251030
1026 listing = broker.list_objects_iter(10, '3/0045', '3/', '/')1031 listing = broker.list_objects_iter(10, '3/0045', None, '3/', '/')
1027 self.assertEquals(len(listing), 10)1032 self.assertEquals(len(listing), 10)
1028 self.assertEquals([row[0] for row in listing],1033 self.assertEquals([row[0] for row in listing],
1029 ['3/0045/', '3/0046', '3/0046/', '3/0047',1034 ['3/0045/', '3/0046', '3/0046/', '3/0047',
@@ -1032,33 +1037,34 @@
10321037
1033 broker.put_object('3/0049/', normalize_timestamp(time()), 0,1038 broker.put_object('3/0049/', normalize_timestamp(time()), 0,
1034 'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')1039 'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')
1035 listing = broker.list_objects_iter(10, '3/0048', None, None)1040 listing = broker.list_objects_iter(10, '3/0048', None, None, None)
1036 self.assertEquals(len(listing), 10)1041 self.assertEquals(len(listing), 10)
1037 self.assertEquals([row[0] for row in listing],1042 self.assertEquals([row[0] for row in listing],
1038 ['3/0048/0049', '3/0049', '3/0049/',1043 ['3/0048/0049', '3/0049', '3/0049/',
1039 '3/0049/0049', '3/0050', '3/0050/0049', '3/0051', '3/0051/0049',1044 '3/0049/0049', '3/0050', '3/0050/0049', '3/0051', '3/0051/0049',
1040 '3/0052', '3/0052/0049'])1045 '3/0052', '3/0052/0049'])
10411046
1042 listing = broker.list_objects_iter(10, '3/0048', '3/', '/')1047 listing = broker.list_objects_iter(10, '3/0048', None, '3/', '/')
1043 self.assertEquals(len(listing), 10)1048 self.assertEquals(len(listing), 10)
1044 self.assertEquals([row[0] for row in listing],1049 self.assertEquals([row[0] for row in listing],
1045 ['3/0048/', '3/0049', '3/0049/', '3/0050',1050 ['3/0048/', '3/0049', '3/0049/', '3/0050',
1046 '3/0050/', '3/0051', '3/0051/', '3/0052', '3/0052/', '3/0053'])1051 '3/0050/', '3/0051', '3/0051/', '3/0052', '3/0052/', '3/0053'])
10471052
1048 listing = broker.list_objects_iter(10, None, '3/0049/', '/')1053 listing = broker.list_objects_iter(10, None, None, '3/0049/', '/')
1049 self.assertEquals(len(listing), 2)1054 self.assertEquals(len(listing), 2)
1050 self.assertEquals([row[0] for row in listing],1055 self.assertEquals([row[0] for row in listing],
1051 ['3/0049/', '3/0049/0049'])1056 ['3/0049/', '3/0049/0049'])
10521057
1053 listing = broker.list_objects_iter(10, None, None, None, '3/0049')1058 listing = broker.list_objects_iter(10, None, None, None, None,
1059 '3/0049')
1054 self.assertEquals(len(listing), 1)1060 self.assertEquals(len(listing), 1)
1055 self.assertEquals([row[0] for row in listing], ['3/0049/0049'])1061 self.assertEquals([row[0] for row in listing], ['3/0049/0049'])
10561062
1057 listing = broker.list_objects_iter(2, None, '3/', '/')1063 listing = broker.list_objects_iter(2, None, None, '3/', '/')
1058 self.assertEquals(len(listing), 2)1064 self.assertEquals(len(listing), 2)
1059 self.assertEquals([row[0] for row in listing], ['3/0000', '3/0000/'])1065 self.assertEquals([row[0] for row in listing], ['3/0000', '3/0000/'])
10601066
1061 listing = broker.list_objects_iter(2, None, None, None, '3')1067 listing = broker.list_objects_iter(2, None, None, None, None, '3')
1062 self.assertEquals(len(listing), 2)1068 self.assertEquals(len(listing), 2)
1063 self.assertEquals([row[0] for row in listing], ['3/0000', '3/0001'])1069 self.assertEquals([row[0] for row in listing], ['3/0000', '3/0001'])
10641070
@@ -1082,11 +1088,11 @@
10821088
1083 #def list_objects_iter(self, limit, marker, prefix, delimiter, path=None,1089 #def list_objects_iter(self, limit, marker, prefix, delimiter, path=None,
1084 # format=None):1090 # format=None):
1085 listing = broker.list_objects_iter(100, None, '/pets/f', '/')1091 listing = broker.list_objects_iter(100, None, None, '/pets/f', '/')
1086 self.assertEquals([row[0] for row in listing], ['/pets/fish/', '/pets/fish_info.txt'])1092 self.assertEquals([row[0] for row in listing], ['/pets/fish/', '/pets/fish_info.txt'])
1087 listing = broker.list_objects_iter(100, None, '/pets/fish', '/')1093 listing = broker.list_objects_iter(100, None, None, '/pets/fish', '/')
1088 self.assertEquals([row[0] for row in listing], ['/pets/fish/', '/pets/fish_info.txt'])1094 self.assertEquals([row[0] for row in listing], ['/pets/fish/', '/pets/fish_info.txt'])
1089 listing = broker.list_objects_iter(100, None, '/pets/fish/', '/')1095 listing = broker.list_objects_iter(100, None, None, '/pets/fish/', '/')
1090 self.assertEquals([row[0] for row in listing], ['/pets/fish/a', '/pets/fish/b'])1096 self.assertEquals([row[0] for row in listing], ['/pets/fish/a', '/pets/fish/b'])
10911097
1092 def test_double_check_trailing_delimiter(self):1098 def test_double_check_trailing_delimiter(self):
@@ -1114,19 +1120,19 @@
1114 'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')1120 'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')
1115 broker.put_object('c', normalize_timestamp(time()), 0,1121 broker.put_object('c', normalize_timestamp(time()), 0,
1116 'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')1122 'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')
1117 listing = broker.list_objects_iter(15, None, None, None)1123 listing = broker.list_objects_iter(15, None, None, None, None)
1118 self.assertEquals(len(listing), 10)1124 self.assertEquals(len(listing), 10)
1119 self.assertEquals([row[0] for row in listing],1125 self.assertEquals([row[0] for row in listing],
1120 ['a', 'a/', 'a/a', 'a/a/a', 'a/a/b', 'a/b', 'b', 'b/a', 'b/b', 'c'])1126 ['a', 'a/', 'a/a', 'a/a/a', 'a/a/b', 'a/b', 'b', 'b/a', 'b/b', 'c'])
1121 listing = broker.list_objects_iter(15, None, '', '/')1127 listing = broker.list_objects_iter(15, None, None, '', '/')
1122 self.assertEquals(len(listing), 5)1128 self.assertEquals(len(listing), 5)
1123 self.assertEquals([row[0] for row in listing],1129 self.assertEquals([row[0] for row in listing],
1124 ['a', 'a/', 'b', 'b/', 'c'])1130 ['a', 'a/', 'b', 'b/', 'c'])
1125 listing = broker.list_objects_iter(15, None, 'a/', '/')1131 listing = broker.list_objects_iter(15, None, None, 'a/', '/')
1126 self.assertEquals(len(listing), 4)1132 self.assertEquals(len(listing), 4)
1127 self.assertEquals([row[0] for row in listing],1133 self.assertEquals([row[0] for row in listing],
1128 ['a/', 'a/a', 'a/a/', 'a/b'])1134 ['a/', 'a/a', 'a/a/', 'a/b'])
1129 listing = broker.list_objects_iter(15, None, 'b/', '/')1135 listing = broker.list_objects_iter(15, None, None, 'b/', '/')
1130 self.assertEquals(len(listing), 2)1136 self.assertEquals(len(listing), 2)
1131 self.assertEquals([row[0] for row in listing], ['b/a', 'b/b'])1137 self.assertEquals([row[0] for row in listing], ['b/a', 'b/b'])
11321138
@@ -1646,57 +1652,62 @@
1646 broker.put_container('3/%04d/0049' % cont,1652 broker.put_container('3/%04d/0049' % cont,
1647 normalize_timestamp(time()), 0, 0, 0)1653 normalize_timestamp(time()), 0, 0, 0)
16481654
1649 listing = broker.list_containers_iter(100, '', None, '')1655 listing = broker.list_containers_iter(100, '', None, None, '')
1650 self.assertEquals(len(listing), 100)1656 self.assertEquals(len(listing), 100)
1651 self.assertEquals(listing[0][0], '0/0000')1657 self.assertEquals(listing[0][0], '0/0000')
1652 self.assertEquals(listing[-1][0], '0/0099')1658 self.assertEquals(listing[-1][0], '0/0099')
16531659
1654 listing = broker.list_containers_iter(100, '0/0099', None, '')1660 listing = broker.list_containers_iter(100, '', '0/0050', None, '')
1661 self.assertEquals(len(listing), 51)
1662 self.assertEquals(listing[0][0], '0/0000')
1663 self.assertEquals(listing[-1][0], '0/0050')
1664
1665 listing = broker.list_containers_iter(100, '0/0099', None, None, '')
1655 self.assertEquals(len(listing), 100)1666 self.assertEquals(len(listing), 100)
1656 self.assertEquals(listing[0][0], '0/0100')1667 self.assertEquals(listing[0][0], '0/0100')
1657 self.assertEquals(listing[-1][0], '1/0074')1668 self.assertEquals(listing[-1][0], '1/0074')
16581669
1659 listing = broker.list_containers_iter(55, '1/0074', None, '')1670 listing = broker.list_containers_iter(55, '1/0074', None, None, '')
1660 self.assertEquals(len(listing), 55)1671 self.assertEquals(len(listing), 55)
1661 self.assertEquals(listing[0][0], '1/0075')1672 self.assertEquals(listing[0][0], '1/0075')
1662 self.assertEquals(listing[-1][0], '2/0004')1673 self.assertEquals(listing[-1][0], '2/0004')
16631674
1664 listing = broker.list_containers_iter(10, '', '0/01', '')1675 listing = broker.list_containers_iter(10, '', None, '0/01', '')
1665 self.assertEquals(len(listing), 10)1676 self.assertEquals(len(listing), 10)
1666 self.assertEquals(listing[0][0], '0/0100')1677 self.assertEquals(listing[0][0], '0/0100')
1667 self.assertEquals(listing[-1][0], '0/0109')1678 self.assertEquals(listing[-1][0], '0/0109')
16681679
1669 listing = broker.list_containers_iter(10, '', '0/01', '/')1680 listing = broker.list_containers_iter(10, '', None, '0/01', '/')
1670 self.assertEquals(len(listing), 10)1681 self.assertEquals(len(listing), 10)
1671 self.assertEquals(listing[0][0], '0/0100')1682 self.assertEquals(listing[0][0], '0/0100')
1672 self.assertEquals(listing[-1][0], '0/0109')1683 self.assertEquals(listing[-1][0], '0/0109')
16731684
1674 listing = broker.list_containers_iter(10, '', '0/', '/')1685 listing = broker.list_containers_iter(10, '', None, '0/', '/')
1675 self.assertEquals(len(listing), 10)1686 self.assertEquals(len(listing), 10)
1676 self.assertEquals(listing[0][0], '0/0000')1687 self.assertEquals(listing[0][0], '0/0000')
1677 self.assertEquals(listing[-1][0], '0/0009')1688 self.assertEquals(listing[-1][0], '0/0009')
16781689
1679 listing = broker.list_containers_iter(10, '', '', '/')1690 listing = broker.list_containers_iter(10, '', None, '', '/')
1680 self.assertEquals(len(listing), 4)1691 self.assertEquals(len(listing), 4)
1681 self.assertEquals([row[0] for row in listing],1692 self.assertEquals([row[0] for row in listing],
1682 ['0/', '1/', '2/', '3/'])1693 ['0/', '1/', '2/', '3/'])
16831694
1684 listing = broker.list_containers_iter(10, '2/', None, '/')1695 listing = broker.list_containers_iter(10, '2/', None, None, '/')
1685 self.assertEquals(len(listing), 1)1696 self.assertEquals(len(listing), 1)
1686 self.assertEquals([row[0] for row in listing], ['3/'])1697 self.assertEquals([row[0] for row in listing], ['3/'])
16871698
1688 listing = broker.list_containers_iter(10, '', '2', '/')1699 listing = broker.list_containers_iter(10, '', None, '2', '/')
1689 self.assertEquals(len(listing), 1)1700 self.assertEquals(len(listing), 1)
1690 self.assertEquals([row[0] for row in listing], ['2/'])1701 self.assertEquals([row[0] for row in listing], ['2/'])
16911702
1692 listing = broker.list_containers_iter(10, '2/0050', '2/', '/')1703 listing = broker.list_containers_iter(10, '2/0050', None, '2/', '/')
1693 self.assertEquals(len(listing), 10)1704 self.assertEquals(len(listing), 10)
1694 self.assertEquals(listing[0][0], '2/0051')1705 self.assertEquals(listing[0][0], '2/0051')
1695 self.assertEquals(listing[1][0], '2/0051/')1706 self.assertEquals(listing[1][0], '2/0051/')
1696 self.assertEquals(listing[2][0], '2/0052')1707 self.assertEquals(listing[2][0], '2/0052')
1697 self.assertEquals(listing[-1][0], '2/0059')1708 self.assertEquals(listing[-1][0], '2/0059')
16981709
1699 listing = broker.list_containers_iter(10, '3/0045', '3/', '/')1710 listing = broker.list_containers_iter(10, '3/0045', None, '3/', '/')
1700 self.assertEquals(len(listing), 10)1711 self.assertEquals(len(listing), 10)
1701 self.assertEquals([row[0] for row in listing],1712 self.assertEquals([row[0] for row in listing],
1702 ['3/0045/', '3/0046', '3/0046/', '3/0047',1713 ['3/0045/', '3/0046', '3/0046/', '3/0047',
@@ -1704,21 +1715,21 @@
1704 '3/0049/', '3/0050'])1715 '3/0049/', '3/0050'])
17051716
1706 broker.put_container('3/0049/', normalize_timestamp(time()), 0, 0, 0)1717 broker.put_container('3/0049/', normalize_timestamp(time()), 0, 0, 0)
1707 listing = broker.list_containers_iter(10, '3/0048', None, None)1718 listing = broker.list_containers_iter(10, '3/0048', None, None, None)
1708 self.assertEquals(len(listing), 10)1719 self.assertEquals(len(listing), 10)
1709 self.assertEquals([row[0] for row in listing],1720 self.assertEquals([row[0] for row in listing],
1710 ['3/0048/0049', '3/0049', '3/0049/', '3/0049/0049',1721 ['3/0048/0049', '3/0049', '3/0049/', '3/0049/0049',
1711 '3/0050', '3/0050/0049', '3/0051', '3/0051/0049',1722 '3/0050', '3/0050/0049', '3/0051', '3/0051/0049',
1712 '3/0052', '3/0052/0049'])1723 '3/0052', '3/0052/0049'])
17131724
1714 listing = broker.list_containers_iter(10, '3/0048', '3/', '/')1725 listing = broker.list_containers_iter(10, '3/0048', None, '3/', '/')
1715 self.assertEquals(len(listing), 10)1726 self.assertEquals(len(listing), 10)
1716 self.assertEquals([row[0] for row in listing],1727 self.assertEquals([row[0] for row in listing],
1717 ['3/0048/', '3/0049', '3/0049/', '3/0050',1728 ['3/0048/', '3/0049', '3/0049/', '3/0050',
1718 '3/0050/', '3/0051', '3/0051/', '3/0052',1729 '3/0050/', '3/0051', '3/0051/', '3/0052',
1719 '3/0052/', '3/0053'])1730 '3/0052/', '3/0053'])
17201731
1721 listing = broker.list_containers_iter(10, None, '3/0049/', '/')1732 listing = broker.list_containers_iter(10, None, None, '3/0049/', '/')
1722 self.assertEquals(len(listing), 2)1733 self.assertEquals(len(listing), 2)
1723 self.assertEquals([row[0] for row in listing],1734 self.assertEquals([row[0] for row in listing],
1724 ['3/0049/', '3/0049/0049'])1735 ['3/0049/', '3/0049/0049'])
@@ -1738,20 +1749,20 @@
1738 broker.put_container('b/a', normalize_timestamp(time()), 0, 0, 0)1749 broker.put_container('b/a', normalize_timestamp(time()), 0, 0, 0)
1739 broker.put_container('b/b', normalize_timestamp(time()), 0, 0, 0)1750 broker.put_container('b/b', normalize_timestamp(time()), 0, 0, 0)
1740 broker.put_container('c', normalize_timestamp(time()), 0, 0, 0)1751 broker.put_container('c', normalize_timestamp(time()), 0, 0, 0)
1741 listing = broker.list_containers_iter(15, None, None, None)1752 listing = broker.list_containers_iter(15, None, None, None, None)
1742 self.assertEquals(len(listing), 10)1753 self.assertEquals(len(listing), 10)
1743 self.assertEquals([row[0] for row in listing],1754 self.assertEquals([row[0] for row in listing],
1744 ['a', 'a/', 'a/a', 'a/a/a', 'a/a/b', 'a/b', 'b',1755 ['a', 'a/', 'a/a', 'a/a/a', 'a/a/b', 'a/b', 'b',
1745 'b/a', 'b/b', 'c'])1756 'b/a', 'b/b', 'c'])
1746 listing = broker.list_containers_iter(15, None, '', '/')1757 listing = broker.list_containers_iter(15, None, None, '', '/')
1747 self.assertEquals(len(listing), 5)1758 self.assertEquals(len(listing), 5)
1748 self.assertEquals([row[0] for row in listing],1759 self.assertEquals([row[0] for row in listing],
1749 ['a', 'a/', 'b', 'b/', 'c'])1760 ['a', 'a/', 'b', 'b/', 'c'])
1750 listing = broker.list_containers_iter(15, None, 'a/', '/')1761 listing = broker.list_containers_iter(15, None, None, 'a/', '/')
1751 self.assertEquals(len(listing), 4)1762 self.assertEquals(len(listing), 4)
1752 self.assertEquals([row[0] for row in listing],1763 self.assertEquals([row[0] for row in listing],
1753 ['a/', 'a/a', 'a/a/', 'a/b'])1764 ['a/', 'a/a', 'a/a/', 'a/b'])
1754 listing = broker.list_containers_iter(15, None, 'b/', '/')1765 listing = broker.list_containers_iter(15, None, None, 'b/', '/')
1755 self.assertEquals(len(listing), 2)1766 self.assertEquals(len(listing), 2)
1756 self.assertEquals([row[0] for row in listing], ['b/a', 'b/b'])1767 self.assertEquals([row[0] for row in listing], ['b/a', 'b/b'])
17571768
17581769
=== modified file 'test/unit/stats/test_log_processor.py'
--- test/unit/stats/test_log_processor.py 2010-11-05 05:26:53 +0000
+++ test/unit/stats/test_log_processor.py 2010-11-17 15:38:03 +0000
@@ -46,12 +46,16 @@
46 pass46 pass
4747
48class DumbInternalProxy(object):48class DumbInternalProxy(object):
49 def get_container_list(self, account, container, marker=None):49 def get_container_list(self, account, container, marker=None,
50 end_marker=None):
50 n = '2010/03/14/13/obj1'51 n = '2010/03/14/13/obj1'
51 if marker is None or n > marker:52 if marker is None or n > marker:
53 if end_marker and n <= end_marker:
54 return [{'name': n}]
55 elif end_marker:
56 return []
52 return [{'name': n}]57 return [{'name': n}]
53 else:58 return []
54 return []
5559
56 def get_object(self, account, container, object_name):60 def get_object(self, account, container, object_name):
57 code = 20061 code = 200