edit_file patch

John Berthels jjberthels at gmail.com
Tue Jul 24 14:16:46 UTC 2007


Hi folks,

As discussed here:
http://lists.danga.com/pipermail/mogilefs/2007-June/001069.html,
attached is a patch which implements an edit_file command.

This patch:

- adds a parallel method of wrapping filehandles,
'MogileFS::ClientHTTPFile', which is written in terms of LWP rather
than directly to the socket layer.

This implements a seekable read/write filehandle, with the same 'do
create_close on close' behaviour as MogileFS::NewHTTPFile. It will
fail across multiple URLs at 'tie' time.

File operations are translated immediately into HTTP operations. This
is beneficial for large files, since data is not accumulated in memory
(but requires a store with support for partial PUT).


- adds a read_file method to MogileFS::Client

this is a wrapper which returns a readonly ClientHTTPFile around the
results of get_paths


- adds an edit_file method to MogileFS::Client (and a corresponding
cmd_edit_file in MogileFS::Worker::Query on the back-end).

The client edit_file returns a (read-write) ClientHTTPFile. The URL it
works against is of a replica which has been disassociated from the
key and associated with a new FID which is registered as a tempfile
(with the same key).

All being well, the existing create_close logic will delete all old
replicas with this key when the filehandle returned from edit_file is
closed, and the new file contents will replicate out.

[This follows the implementation description in the message linked above.]


I'd be interested in getting functionality like this into mainline
MogileFS, so please let me know what you think of the approach and
what sorts of changes you think might be needed to the patch before
that could happen.


regards,

jb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mogile-edit-file-1.patch.gz
Type: application/x-gzip
Size: 6048 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/mogilefs/attachments/20070724/412183ce/mogile-edit-file-1.patch.bin


More information about the mogilefs mailing list