Jonathan,
Thanks for the RT report. I understand the issue you are experiencing and can see why the
IN_CLOSE_WRITE event might work better for you than the current events.
On the other hand, AEFN is meant to provide a cross platform solution to watching a file
system under AnyEvent. None of the other backend implementations (KQueue, FSEvent nor a
dumb scan of the directory tree) support the a written and closed event (as far as I can tell).
Having AEFN fire off different events depending on the backend seems like an invitation for
confusion and bugs.
That siad, I have been considering exposing the flags passed to Inotify's watch() and
KQueue's EV_SET(). If that were the case, you could then replace the IN_MODIFY flag with
IN_CLOSE_WRITE. You would then get a "modified" event only when the file is written and
closed. No event would be received when the file is written but left open.
Would that be an adequate solution for your purposes?
Thanks,
Mark
On Mon Jan 21 04:13:51 2013, JAM wrote:
Show quoted text> It is crucial to be able to trigger AnyEvent when a file has been
> COMPLETELY written. Only at that point, in many applications, is the
> file ready to be read.
>
> The AEFN::Event model captures only three event types: create, modify,
> and delete. These are inadequate for the use case above. All three of
> these event types get triggered at other times, but not when a series of
> writes has been COMPLETED.
>
> Normally, the file-completion event is captured via inotify by
> monitoring the IN_CLOSE_WRITE event, which triggers when a file opened
> for writing is finally closed.
>
> Can you please augment the AEFN::Event model to capture the inotify
> event types that are missing? In particular, would you please add a
> "close_write" event type to AEFN::Event.
>
> Thank you.