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:
Alexandre Lécuyer 2017-03-21 09:54:33 +01:00
parent 5507df14e8
commit cff7455a68
5 changed files with 7 additions and 31 deletions

View File

@ -1351,7 +1351,7 @@ class BaseDiskFileManager(object):
def yield_hashes(self, device, partition, policy,
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
(optionally) suffixes. If suffixes is None, all stored
suffixes will be searched for object hashes. Note that if
@ -1407,7 +1407,7 @@ class BaseDiskFileManager(object):
# file cannot be opened and therefore cannot
# be ssync'd
continue
yield (object_path, object_hash, timestamps)
yield (object_hash, timestamps)
except AssertionError as err:
self.logger.debug('Invalid file set in %s (%s)' % (
object_path, err))

View File

@ -271,10 +271,10 @@ class Sender(object):
frag_index=self.job.get('frag_index'))
if self.remote_check_objs is not None:
hash_gen = six.moves.filter(
lambda path_objhash_timestamps:
path_objhash_timestamps[1] in
lambda objhash_timestamps:
objhash_timestamps[0] in
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
with exceptions.MessageTimeout(
self.daemon.node_timeout,

View File

@ -1183,7 +1183,7 @@ class DiskFileManagerMixin(BaseDiskFileTestMixin):
return files
self.fail('Unexpected listdir of %r' % path)
expected_items = [
(os.path.join(part_path, hash_[-3:], hash_), hash_, timestamps)
(hash_, timestamps)
for hash_, timestamps in expected.items()]
with mock.patch('os.listdir', _listdir), \
mock.patch('os.unlink'):

View File

@ -909,7 +909,7 @@ class TestGlobalSetupObjectReconstructor(unittest.TestCase):
self.job['policy'], self.suffixes,
frag_index=self.job.get('frag_index'))
self.available_map = {}
for path, hash_, timestamps in hash_gen:
for hash_, timestamps in hash_gen:
self.available_map[hash_] = timestamps
context['available_map'] = self.available_map
ssync_calls.append(context)

View File

@ -433,8 +433,6 @@ class TestSender(BaseTest):
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
and policy == POLICIES.legacy:
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000),
'ts_meta': Timestamp(1380155570.00005)})
@ -483,8 +481,6 @@ class TestSender(BaseTest):
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
and policy == POLICIES.legacy:
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -521,8 +517,6 @@ class TestSender(BaseTest):
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
and policy == POLICIES.legacy:
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -557,8 +551,6 @@ class TestSender(BaseTest):
if device == 'dev' and partition == '9' and suffixes == ['abc'] \
and policy == POLICIES.legacy:
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -758,19 +750,13 @@ class TestSender(BaseTest):
policy == POLICIES.legacy and
suffixes == ['abc', 'def']):
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
yield (
'/srv/node/dev/objects/9/def/'
'9d41d8cd98f00b204e9800998ecf0def',
'9d41d8cd98f00b204e9800998ecf0def',
{'ts_data': Timestamp(1380144472.22222),
'ts_meta': Timestamp(1380144473.22222)})
yield (
'/srv/node/dev/objects/9/def/'
'9d41d8cd98f00b204e9800998ecf1def',
'9d41d8cd98f00b204e9800998ecf1def',
{'ts_data': Timestamp(1380144474.44444),
'ts_ctype': Timestamp(1380144474.44448),
@ -820,8 +806,6 @@ class TestSender(BaseTest):
policy == POLICIES.legacy and
suffixes == ['abc']):
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -859,8 +843,6 @@ class TestSender(BaseTest):
policy == POLICIES.legacy and
suffixes == ['abc']):
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -899,8 +881,6 @@ class TestSender(BaseTest):
policy == POLICIES.legacy and
suffixes == ['abc']):
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -938,8 +918,6 @@ class TestSender(BaseTest):
policy == POLICIES.legacy and
suffixes == ['abc']):
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else:
@ -980,8 +958,6 @@ class TestSender(BaseTest):
policy == POLICIES.legacy and
suffixes == ['abc']):
yield (
'/srv/node/dev/objects/9/abc/'
'9d41d8cd98f00b204e9800998ecf0abc',
'9d41d8cd98f00b204e9800998ecf0abc',
{'ts_data': Timestamp(1380144470.00000)})
else: