bwester / consulfs

ConsulFS is a FUSE distributed filesystem backed by a Consul Key-Value store
Other
73 stars 11 forks source link

mv command is not possible #6

Open LordFPL opened 7 years ago

LordFPL commented 7 years ago

Hello,

Thx for this projet, it can be very usefull... but in my case i'm blocked due to the mv command forbiden. I create this issue in case you have a solution, or for others.

All the best :)

bwester commented 7 years ago

Hi, thanks for looking at this project!

There's a good reason for the omission. The "mv" command is implemented using the "rename" operation on a file system, which POSIX says should be atomic. If interrupted, the source and destination paths must either be both unmodified or both changed. It's the only multi-file atomic operation in a POSIX file system, so a lot of software uses it to provide safe modifications.

When I started, Consul didn't support an atomic operation that would remove one key and add another. Rather than implement a non-atomic rename, I just disabled renames altogether. However, a "transaction" endpoint was added to Consul 0.7.0, making it possible to implement as a copy-and-delete operation.

I'll leave this issue open to document the feature request. I make no promise as to when I can build out this piece of functionality.

LordFPL commented 7 years ago

Many thanks for this (very) complete answer :) For information, i have asked to consul group information about an official solution like yours : https://groups.google.com/forum/#!topic/consul-tool/TaPpkq3MdoY