7d70e05aeb
This set of changes reworks the DiskFile class to remove the "extension" parameter from the put() method, offering the new put_metadata() method with an optional tombstone keyword boolean, and changes the mkstemp method to only return the file descriptor. Reviewing the code it was found that the temporary file name created as a result of calling DiskFile.mkstemp() was never used by the caller, but the caller was responsible for passing it back to the DiskFile.put() method. That seems like too much information is exposed to the caller, when all the caller requires is the file descriptor to write data into it. Upon further review, the mkstemp() method was used in three places: PUT, POST and DELETE method handling. Of those three cases, only PUT requires the file descriptor, since it is responsible for writing the object contents. For POST and DELETE, DiskFile only needs to associate metadata with the correct file name. We abstract the pattern that those two use (once we also refactor the code to move the fetch of the delete-at metadata, and subsequent delete-at-update initiation, from under the mkstemp context) by adding the new put_metadata() method. As a result, the DiskFile class is then free to do whatever file system operations it must to meet the API, without the caller having to know more than just how to write data to a file descriptor. Note that DiskFile itself key'd off of the '.ts' and '.meta' extensions for its operations, and for that to work properly, the caller had to know to use those correctly. With this change, the caller has no knowledge of how the file system is being used to accomplish data and metadata storage. See also Question 213796 at: https://answers.launchpad.net/swift/+question/213796 Change-Id: I267f68e64391ba627b2a13682393bec62600159d Signed-off-by: Peter Portante <peter.portante@redhat.com>