diff options
author | Peter Portante <peter.portante@redhat.com> | 2012-10-31 20:28:42 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-16 04:50:34 -0800 |
commit | b696fc0e595d14404d3659bf15069addf3cf95f6 (patch) | |
tree | eb86dc8544ed012eeaaf015a9da4de17172d8cf3 /swift/1.4.8/plugins | |
parent | ffc7618270522bb4550d29a11a81ab5aeca42d99 (diff) |
object-storage: reduce diffs, bury metadata update
Further reduce the diffs we have to carry by moving the Gluster specific
metadata stored when we create an object to the DiskFile class's put() method.
Change-Id: I8cef5412627d3ddfdadbf78ef947e067db5bf620
BUG: 870589
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4177
Reviewed-by: Pete Zaitcev <zaitcev@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Mohammed Junaid <junaid@redhat.com>
Diffstat (limited to 'swift/1.4.8/plugins')
-rw-r--r-- | swift/1.4.8/plugins/DiskFile.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/swift/1.4.8/plugins/DiskFile.py b/swift/1.4.8/plugins/DiskFile.py index 1f74ff2a59f..61b1c9cf99b 100644 --- a/swift/1.4.8/plugins/DiskFile.py +++ b/swift/1.4.8/plugins/DiskFile.py @@ -167,25 +167,42 @@ class Gluster_DiskFile(DiskFile): :param metadata: dictionary of metadata to be written :param extention: extension to be used when making the file """ - #Marker dir. if extension == '.ts': + # TombStone marker (deleted) return True + + # Fix up the metadata to ensure it has a proper value for the + # Content-Type metadata, as well as an X_TYPE and X_OBJECT_TYPE + # metadata values. + + content_type = metadata['Content-Type'] + if not content_type: + metadata['Content-Type'] = FILE_TYPE + x_object_type = FILE + else: + x_object_type = MARKER_DIR if content_type.lower() == DIR_TYPE else FILE + metadata[X_TYPE] = OBJECT + metadata[X_OBJECT_TYPE] = x_object_type + if extension == '.meta': + # Metadata recorded separately from the file self.put_metadata(metadata) return True - else: - extension = '' + + extension = '' + if metadata[X_OBJECT_TYPE] == MARKER_DIR: self.create_dir_object(os.path.join(self.datadir, self.obj)) self.put_metadata(metadata) self.data_file = self.datadir + '/' + self.obj return True - #Check if directory already exists. + + # Check if directory already exists. if self.is_dir: self.logger.error('Directory already exists %s/%s' % \ (self.datadir , self.obj)) return False - #metadata['name'] = self.name + timestamp = normalize_timestamp(metadata[X_TIMESTAMP]) write_metadata(tmppath, metadata) if X_CONTENT_LENGTH in metadata: @@ -211,7 +228,6 @@ class Gluster_DiskFile(DiskFile): do_chown(os.path.join(self.datadir, self.obj + extension), \ self.uid, self.gid) self.metadata = metadata - #self.logger.error("Meta %s", self.metadata) self.data_file = self.datadir + '/' + self.obj + extension return True |