ARK-Builders/ark-core

`fs-index`: Filesystem monitoring using `notify-rs`

Opened this issue · 0 comments

Description

Use notify-rs to enable filesystem monitoring for a specified root folder. This functionality would automatically update the index if any changes were detected within the watched directory.

Motivation

  • Enhance UX with a straightforward solution for keeping the index up-to-date.

Proposal

We've decided to add a method ResourceIndex::watch_index() to monitor a specific directory for changes and update the index whenever a change is detected.
For interacting with this method, we'll add a command to ark-cli which is ark-cli watch <path>

To further build on this, we plan to enhance this functionality to enable watching multiple directories simultaneously. This will be possible through the following commands:

  • ark-cli watch --all to watch all specified directories.
  • ark-cli watch pin <path> to add a directory to the watch list.
  • ark-cli watch unpin <path> to stop watching a directory.
  • ark-cli watch list to list the directories currently being watched.

We can also have a global configuration file, such as /Users/<username>/.ark/directories_to_watch, to store the list of directories to monitor.