feat: add filesystem watch support to local_file source#97
Conversation
Port upstream feature from cocoindex-io/cocoindex#1669 to enable real-time change detection for the LocalFile source using the notify crate. Changes: - Add notify 8.2.0 dependency to workspace and recoco-core - Wire notify into source-local-file feature - Add optional watch_changes field to Spec (defaults to false) - Add watch_changes field to Executor - Implement change_stream() method using notify::RecommendedWatcher - Add Clone derive to PatternMatcher for use in async stream - Filter filesystem events through existing PatternMatcher The feature is opt-in and fully backward-compatible. When enabled, the source bridges filesystem events via tokio::sync::mpsc into the change_stream() interface for low-latency continuous indexing. Related to #27 Co-authored-by: Adam Poulemanos <bashandbone@users.noreply.github.com>
|
🤖 Hi @bashandbone, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
Pull request overview
Ports upstream filesystem watch support to the LocalFile source so it can emit real-time change notifications (opt-in via watch_changes) using the notify crate, integrated behind the source-local-file feature.
Changes:
- Add
notify = 8.2.0as a workspace dependency and wire it intorecoco-core’ssource-local-filefeature. - Extend
LocalFilespec/executor withwatch_changesand implementchange_stream()usingnotify::RecommendedWatcher. - Make
PatternMatcherclonable so it can be moved into the async change stream.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/recoco-core/src/ops/sources/shared/pattern_matcher.rs | Derive Clone for PatternMatcher to support async streaming usage. |
| crates/recoco-core/src/ops/sources/local_file.rs | Add watch_changes and implement filesystem-based change_stream() for LocalFile. |
| crates/recoco-core/Cargo.toml | Add optional notify dep and include it in source-local-file feature. |
| Cargo.toml | Add notify to workspace dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
recoco-docs | e836298 | Mar 16 2026, 02:55 AM |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
|
👋 Hey @bashandbone, Thanks for your contribution to codeweaver! 🧵You need to agree to the CLA first... 🖊️Before we can accept your contribution, you need to agree to our Contributor License Agreement (CLA). To agree to the CLA, please comment:
Those exact words are important1, so please don't change them. 😉 You can read the full CLA here: Contributor License Agreement ✅ @bashandbone has signed the CLA. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. Footnotes
|
There was a problem hiding this comment.
Pull request overview
Adds opt-in filesystem watch support to the LocalFile source in recoco-core, enabling real-time change detection via notify when watch_changes is enabled.
Changes:
- Add
notifyas an optional workspace +recoco-coredependency and wire it into thesource-local-filefeature. - Extend
LocalFileSpec/Executorwithwatch_changesand implementchange_stream()usingnotify::RecommendedWatcher. - Derive
CloneforPatternMatcherto support use inside the async change stream.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Cargo.toml | Adds notify = 8.2.0 to workspace dependencies. |
| crates/recoco-core/Cargo.toml | Adds optional notify dep and includes it in source-local-file feature. |
| crates/recoco-core/src/ops/sources/local_file.rs | Adds watch_changes config and implements change_stream() using notify. |
| crates/recoco-core/src/ops/sources/shared/pattern_matcher.rs | Adds Clone derive to allow matcher cloning into the stream. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let (tx, mut rx) = mpsc::channel::<PathBuf>(100); | ||
|
|
||
| let mut watcher = RecommendedWatcher::new( | ||
| move |res: notify::Result<notify::Event>| { | ||
| if let Ok(event) = res { | ||
| for path in event.paths { | ||
| if let Err(err) = tx.try_send(path) { | ||
| use tokio::sync::mpsc::error::TrySendError; | ||
| match err { | ||
| TrySendError::Full(_) => { | ||
| warn!("File watcher channel is full; dropping file change event"); | ||
| } | ||
| TrySendError::Closed(_) => { |
| // Filter through pattern matcher | ||
| if pattern_matcher.is_file_included(relative_path) { | ||
| yield Ok(SourceChangeMessage { | ||
| changes: vec![SourceChange { | ||
| key: KeyValue::from_single_part(relative_path.to_string()), |
| if let Ok(event) = res { | ||
| for path in event.paths { | ||
| if let Err(err) = tx.try_send(path) { | ||
| use tokio::sync::mpsc::error::TrySendError; | ||
| match err { | ||
| TrySendError::Full(_) => { | ||
| warn!("File watcher channel is full; dropping file change event"); | ||
| } | ||
| TrySendError::Closed(_) => { | ||
| warn!("File watcher channel is closed; dropping file change event"); | ||
| } | ||
| } | ||
| } | ||
| } |
| json5 = "1.3.0" | ||
| log = "0.4.29" | ||
| neo4rs = "0.8.0" | ||
| notify = "8.2.0" |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@bashandbone I've opened a new pull request, #98, to work on those changes. Once the pull request is ready, I'll request review from you. |
…mplementation (#98) * Initial plan * fix: address review feedback on change_stream() in local_file source Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com> --------- Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Summary
Port upstream feature from cocoindex-io/cocoindex#1669 to enable real-time change detection for the LocalFile source using the
notifycrate.Changes
notify 8.2.0dependency to workspace and recoco-corenotifyintosource-local-filefeaturewatch_changesfield to Spec (defaults to false)watch_changesfield to Executorchange_stream()method usingnotify::RecommendedWatcherThe feature is opt-in and fully backward-compatible. When enabled, the source bridges filesystem events via
tokio::sync::mpscinto thechange_stream()interface for low-latency continuous indexing.Closes #51
Related to #27
Generated with Claude Code