summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2012-10-29 15:47:09 -0400
committerPeter Portante <peter.portante@redhat.com>2013-04-29 16:35:56 -0400
commit4f7b524287dfd1b4008bab8d62b1880c86851b73 (patch)
tree1c6061453d65d9f8df80cce2228aafc56f31270b
parent80146100bd4f27c3cce0fcb92c636201f0c57c6f (diff)
object-storage: rename self.name to self.container
Minor refactoring ahead of further diffs to add clarity to the code. Rename the DiskDir field from "name" to "container", which is what it is. Along the way, add a note regarding the one-to-one mapping of account name to gluster volume name, and fix the get_info() container method documentation to list all the dictionary keys returned. Change-Id: I659e1a9a070c16671287f17a170f9d77198534e7 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4169 Reviewed-by: Pete Zaitcev <zaitcev@redhat.com> Reviewed-by: Mohammed Junaid <junaid@redhat.com> Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
-rw-r--r--swift/1.4.8/plugins/DiskDir.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/swift/1.4.8/plugins/DiskDir.py b/swift/1.4.8/plugins/DiskDir.py
index 29dec5c..5ce8e8c 100644
--- a/swift/1.4.8/plugins/DiskDir.py
+++ b/swift/1.4.8/plugins/DiskDir.py
@@ -149,13 +149,15 @@ class DiskDir(DiskCommon):
uid=DEFAULT_UID, gid=DEFAULT_GID):
self.root = path
if container:
- self.name = container
+ self.container = container
else:
- self.name = None
- if self.name:
- self.datadir = os.path.join(path, account, self.name)
+ self.container = None
+ if self.container:
+ self.datadir = os.path.join(path, account, self.container)
else:
self.datadir = os.path.join(path, account)
+ # Note that the account name has a one-to-one mapping to the gluster
+ # mount point, or volume name.
self.account = account
if not check_mount(path, account):
check_valid_account(account)
@@ -173,7 +175,7 @@ class DiskDir(DiskCommon):
create_container_metadata(self.datadir)
else:
return
- if container:
+ if self.container:
if not self.metadata:
create_container_metadata(self.datadir)
self.metadata = _read_metadata(self.datadir)
@@ -356,11 +358,10 @@ class DiskDir(DiskCommon):
def get_info(self, include_metadata=False):
"""
Get global data for the container.
- :returns: dict with keys: account, container, created_at,
- put_timestamp, delete_timestamp, object_count, bytes_used,
- reported_put_timestamp, reported_delete_timestamp,
- reported_object_count, reported_bytes_used, hash, id,
- x_container_sync_point1, and x_container_sync_point2.
+ :returns: dict with keys: account, container, object_count, bytes_used,
+ hash, id, created_at, put_timestamp, delete_timestamp,
+ reported_put_timestamp, reported_delete_timestamp,
+ reported_object_count, and reported_bytes_used.
If include_metadata is set, metadata is included as a key
pointing to a dict of tuples of the metadata
"""
@@ -372,7 +373,7 @@ class DiskDir(DiskCommon):
if os.path.exists(self.datadir):
metadata = _read_metadata(self.datadir)
- data = {'account' : self.account, 'container' : self.name,
+ data = {'account' : self.account, 'container' : self.container,
'object_count' : metadata.get(X_OBJECTS_COUNT, ('0', 0))[0],
'bytes_used' : metadata.get(X_BYTES_USED, ('0',0))[0],
'hash': '', 'id' : '', 'created_at' : '1',