dune icon indicating copy to clipboard operation
dune copied to clipboard

Adds native polling mode support on Windows

Open yams-yams opened this issue 2 years ago • 2 comments

Adds support for polling mode on Windows using a new internal library winwatch, which takes inspiration for its structure from fsevents. winwatch uses the Windows ReadDirectoryChangesW API to watch for file changes and an I/O Completion Port to report notifications in a callback. dune_file_watcher now uses winwatch instead of fswatch on native Windows, and notifications received in dune_file_watcher are filtered for relevance before they are passed to scheduler.thread_safe_send_emit_events_job.

One additional change was made for compatibility on Windows: The rpc server typically uses Unix.pipe in non-blocking mode, but non-blocking mode is not supported on Windows. The proposed solution instead uses a blocking pipe that times out every 0.1 second and reblocks.

Potential areas for improvement: The proposed solution does not prevent the same path from being watched multiple times. A potential solution would be a trie that stores paths, like Watch_trie used by for fsevents.

Signed-off-by: Uma Kothuri [email protected]

yams-yams avatar Aug 18 '22 20:08 yams-yams

Just to add a little background information: @yams-yams worked on this project as part of an internship at LexiFi, and we have already discussed the general appraoch internally. I am planning to do a review of the PR, but of course additional reviewers are welcome!

nojb avatar Aug 18 '22 21:08 nojb

The DCO check is failing because your git "Author" name (git config user.name) must match your Signed-Off-by line, ie it must be Uma Kothuri. To change it:

  1. git config user.name "Uma Kothuri";
  2. git commit --reset-author --amend (to update the existing commit at the top of the branch with the new name).

nojb avatar Aug 23 '22 05:08 nojb

@nojb could you move the RPC changes to a separate PR?

rgrinberg avatar Oct 12 '22 14:10 rgrinberg

Thanks for the review @rgrinberg. I am in the process of rebasing it (I started a few days ago, but didn't get enough time to finish). Will amend according to your suggestions.

nojb avatar Oct 12 '22 14:10 nojb

Superceded by #7010

nojb avatar Feb 06 '23 00:02 nojb