Remove unused returned value object_path from yield_hashes()
Some public functions in the diskfile manager expect or return full file paths. It implies a filesystem diskfile implementation. To make it easier to plug alternate diskfile implementations, patch functions to take more generic arguments. This commit changes DiskFileManager yield_hashes() returned values from: - object_path, object_hash, timestamps to: - object_hash, timestamps object_path was not used by any caller. Change-Id: I914fb1ec8ce7c9c26d22e1d07f03bd03f4504176
This commit is contained in:
parent
5507df14e8
commit
cff7455a68
@ -1351,7 +1351,7 @@ class BaseDiskFileManager(object):
|
|||||||
def yield_hashes(self, device, partition, policy,
|
def yield_hashes(self, device, partition, policy,
|
||||||
suffixes=None, **kwargs):
|
suffixes=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Yields tuples of (full_path, hash_only, timestamps) for object
|
Yields tuples of (hash_only, timestamps) for object
|
||||||
information stored for the given device, partition, and
|
information stored for the given device, partition, and
|
||||||
(optionally) suffixes. If suffixes is None, all stored
|
(optionally) suffixes. If suffixes is None, all stored
|
||||||
suffixes will be searched for object hashes. Note that if
|
suffixes will be searched for object hashes. Note that if
|
||||||
@ -1407,7 +1407,7 @@ class BaseDiskFileManager(object):
|
|||||||
# file cannot be opened and therefore cannot
|
# file cannot be opened and therefore cannot
|
||||||
# be ssync'd
|
# be ssync'd
|
||||||
continue
|
continue
|
||||||
yield (object_path, object_hash, timestamps)
|
yield (object_hash, timestamps)
|
||||||
except AssertionError as err:
|
except AssertionError as err:
|
||||||
self.logger.debug('Invalid file set in %s (%s)' % (
|
self.logger.debug('Invalid file set in %s (%s)' % (
|
||||||
object_path, err))
|
object_path, err))
|
||||||
|
@ -271,10 +271,10 @@ class Sender(object):
|
|||||||
frag_index=self.job.get('frag_index'))
|
frag_index=self.job.get('frag_index'))
|
||||||
if self.remote_check_objs is not None:
|
if self.remote_check_objs is not None:
|
||||||
hash_gen = six.moves.filter(
|
hash_gen = six.moves.filter(
|
||||||
lambda path_objhash_timestamps:
|
lambda objhash_timestamps:
|
||||||
path_objhash_timestamps[1] in
|
objhash_timestamps[0] in
|
||||||
self.remote_check_objs, hash_gen)
|
self.remote_check_objs, hash_gen)
|
||||||
for path, object_hash, timestamps in hash_gen:
|
for object_hash, timestamps in hash_gen:
|
||||||
self.available_map[object_hash] = timestamps
|
self.available_map[object_hash] = timestamps
|
||||||
with exceptions.MessageTimeout(
|
with exceptions.MessageTimeout(
|
||||||
self.daemon.node_timeout,
|
self.daemon.node_timeout,
|
||||||
|
@ -1183,7 +1183,7 @@ class DiskFileManagerMixin(BaseDiskFileTestMixin):
|
|||||||
return files
|
return files
|
||||||
self.fail('Unexpected listdir of %r' % path)
|
self.fail('Unexpected listdir of %r' % path)
|
||||||
expected_items = [
|
expected_items = [
|
||||||
(os.path.join(part_path, hash_[-3:], hash_), hash_, timestamps)
|
(hash_, timestamps)
|
||||||
for hash_, timestamps in expected.items()]
|
for hash_, timestamps in expected.items()]
|
||||||
with mock.patch('os.listdir', _listdir), \
|
with mock.patch('os.listdir', _listdir), \
|
||||||
mock.patch('os.unlink'):
|
mock.patch('os.unlink'):
|
||||||
|
@ -909,7 +909,7 @@ class TestGlobalSetupObjectReconstructor(unittest.TestCase):
|
|||||||
self.job['policy'], self.suffixes,
|
self.job['policy'], self.suffixes,
|
||||||
frag_index=self.job.get('frag_index'))
|
frag_index=self.job.get('frag_index'))
|
||||||
self.available_map = {}
|
self.available_map = {}
|
||||||
for path, hash_, timestamps in hash_gen:
|
for hash_, timestamps in hash_gen:
|
||||||
self.available_map[hash_] = timestamps
|
self.available_map[hash_] = timestamps
|
||||||
context['available_map'] = self.available_map
|
context['available_map'] = self.available_map
|
||||||
ssync_calls.append(context)
|
ssync_calls.append(context)
|
||||||
|
@ -433,8 +433,6 @@ class TestSender(BaseTest):
|
|||||||
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
||||||
and policy == POLICIES.legacy:
|
and policy == POLICIES.legacy:
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000),
|
{'ts_data': Timestamp(1380144470.00000),
|
||||||
'ts_meta': Timestamp(1380155570.00005)})
|
'ts_meta': Timestamp(1380155570.00005)})
|
||||||
@ -483,8 +481,6 @@ class TestSender(BaseTest):
|
|||||||
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
||||||
and policy == POLICIES.legacy:
|
and policy == POLICIES.legacy:
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -521,8 +517,6 @@ class TestSender(BaseTest):
|
|||||||
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
||||||
and policy == POLICIES.legacy:
|
and policy == POLICIES.legacy:
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -557,8 +551,6 @@ class TestSender(BaseTest):
|
|||||||
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
|
||||||
and policy == POLICIES.legacy:
|
and policy == POLICIES.legacy:
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -758,19 +750,13 @@ class TestSender(BaseTest):
|
|||||||
policy == POLICIES.legacy and
|
policy == POLICIES.legacy and
|
||||||
suffixes == ['abc', 'def']):
|
suffixes == ['abc', 'def']):
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/def/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0def',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0def',
|
'9d41d8cd98f00b204e9800998ecf0def',
|
||||||
{'ts_data': Timestamp(1380144472.22222),
|
{'ts_data': Timestamp(1380144472.22222),
|
||||||
'ts_meta': Timestamp(1380144473.22222)})
|
'ts_meta': Timestamp(1380144473.22222)})
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/def/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf1def',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf1def',
|
'9d41d8cd98f00b204e9800998ecf1def',
|
||||||
{'ts_data': Timestamp(1380144474.44444),
|
{'ts_data': Timestamp(1380144474.44444),
|
||||||
'ts_ctype': Timestamp(1380144474.44448),
|
'ts_ctype': Timestamp(1380144474.44448),
|
||||||
@ -820,8 +806,6 @@ class TestSender(BaseTest):
|
|||||||
policy == POLICIES.legacy and
|
policy == POLICIES.legacy and
|
||||||
suffixes == ['abc']):
|
suffixes == ['abc']):
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -859,8 +843,6 @@ class TestSender(BaseTest):
|
|||||||
policy == POLICIES.legacy and
|
policy == POLICIES.legacy and
|
||||||
suffixes == ['abc']):
|
suffixes == ['abc']):
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -899,8 +881,6 @@ class TestSender(BaseTest):
|
|||||||
policy == POLICIES.legacy and
|
policy == POLICIES.legacy and
|
||||||
suffixes == ['abc']):
|
suffixes == ['abc']):
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -938,8 +918,6 @@ class TestSender(BaseTest):
|
|||||||
policy == POLICIES.legacy and
|
policy == POLICIES.legacy and
|
||||||
suffixes == ['abc']):
|
suffixes == ['abc']):
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
@ -980,8 +958,6 @@ class TestSender(BaseTest):
|
|||||||
policy == POLICIES.legacy and
|
policy == POLICIES.legacy and
|
||||||
suffixes == ['abc']):
|
suffixes == ['abc']):
|
||||||
yield (
|
yield (
|
||||||
'/srv/node/dev/objects/9/abc/'
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
|
||||||
'9d41d8cd98f00b204e9800998ecf0abc',
|
'9d41d8cd98f00b204e9800998ecf0abc',
|
||||||
{'ts_data': Timestamp(1380144470.00000)})
|
{'ts_data': Timestamp(1380144470.00000)})
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user