Currently, when a user wants to modify a file, the user first calls exists() to know if this file is already there. And then uses create() or append() according to whether the file exists or not.
the code looks like:
. On the performace side,It involes two RPCs. On the easy-of-use side, it is not very convient in contrast to the traditional open interface.
It will more complicate if there is a overwrite parameter specified. I donot know whether there is a bug about 'overwrite' in 0.19, some times it takes a long time for overwrite creates to reture. So i make the write file code with overwrite param works like:
Some code statements there are really redundant and not needed, especialy with the delete(). But without deleting first, the overwrite takes a long time to reture.
BTW, i will create another issue about the overwrite problem. If it is not a bug at all or a duplicate, someone please close it.