Re: PATCH vs PUT w/Content-Range

On Thu, 29 Apr 2004, Lisa Dusseault wrote:

> Updates should be atomic -- the entire patch should be applied or
> entirely failed.  I will make that explicit.

You may want to note in the draft that, in many cases, the atomicity
requirement is expensive because it requires copying the entire
content or "trying to patch" first, before actually patching, while
holding the file lock.

To avoid copying, a special --dry-run feature of the library/program
that supports the given patch format would be needed. In fact, as the
"internal error" part of the example below illustrates, copying may
always be required for safe operation when the patch library/program
does not guarantee atomicity:

	lock
	if patch --dry-run
	then
		if patch
		then
			unlock
			report success
		else
			internal error!
			revert to original content?
			...
		fi
	else
		unlock
		error, report to the client
	fi

Alex.

Received on Thursday, 29 April 2004 14:04:21 UTC