Re:Syncer: fast stateful file/disk data syncer written on Go
by kevan on Sunday September 20, 2015 @04:02AM
(#10246894)
It's late and maybe I missed something looking through the code, but what happens if you don't have write permissions on the directory that the statefile is in? The copy operation is performed but then the state is lost when the statefile rename fails.
[ Parent
| on HN ]
Re:Syncer: fast stateful file/disk data syncer written on Go
by stargrave on Sunday September 20, 2015 @04:06AM
(#10246903)
At first, temporary file created in current directory. So if directory is not writable -- temporary file creation at the very beginning will fail.
Re:Syncer: fast stateful file/disk data syncer written on Go
by kevan on Sunday September 20, 2015 @04:22AM
(#10246922)
Ah, that's what I missed. I guess there's still a possibility of permissions changing during the transfer, but I don't think there's anything you'd want to do to handle that other than error out.
Re:Syncer: fast stateful file/disk data syncer written on Go
by stargrave on Sunday September 20, 2015 @04:26AM
(#10246932)
In that case I will print the message telling that something went wrong but temporary statefile is alive: https://github.com/stargrave/syncer/blob/master/syncer.go#L2...