summaryrefslogtreecommitdiff
path: root/lib/MaildirIndexer/Store.rakumod
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-12-29 18:41:21 +0000
committerdakkar <dakkar@thenautilus.net>2019-12-29 18:41:21 +0000
commitf744eb13bcea64a2b8c3482dfe4c9baf015f8b4b (patch)
tree6cd9b4f7fa108af2df19c7ab7d15cfb5aadbc483 /lib/MaildirIndexer/Store.rakumod
parentnew module extension (diff)
downloadMaildirIndexer-f744eb13bcea64a2b8c3482dfe4c9baf015f8b4b.tar.gz
MaildirIndexer-f744eb13bcea64a2b8c3482dfe4c9baf015f8b4b.tar.bz2
MaildirIndexer-f744eb13bcea64a2b8c3482dfe4c9baf015f8b4b.zip
better scandir
* breadth-first, not depth-first * emits an `End` once all files that were there at the start have been emit-ed
Diffstat (limited to 'lib/MaildirIndexer/Store.rakumod')
-rw-r--r--lib/MaildirIndexer/Store.rakumod7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/MaildirIndexer/Store.rakumod b/lib/MaildirIndexer/Store.rakumod
index 502d60e..03492f7 100644
--- a/lib/MaildirIndexer/Store.rakumod
+++ b/lib/MaildirIndexer/Store.rakumod
@@ -3,6 +3,7 @@ unit class MaildirIndexer::Store;
use MaildirIndexer::LogTimelineSchema;
use MaildirIndexer::Index;
use MaildirIndexer::Parser;
+use MaildirIndexer::ScanDir;
has Lock $!lock .= new;
has MaildirIndexer::Index @.indices is required;
@@ -20,12 +21,14 @@ method start(--> Nil) {
start react {
CATCH { warn $_ };
whenever $.file-channel -> $file {
- if $file.e && $file.f {
+ when $file ~~ MaildirIndexer::ScanDir::End {
+ }
+ when $file ~~ :e & :f {
MaildirIndexer::LogTimelineSchema::Store::Add.log: :file($file.path), -> {
self.add-file($file);
}
}
- elsif !$file.e {
+ when $file ~~ :!e {
MaildirIndexer::LogTimelineSchema::Store::Rm.log: :file($file.path), -> {
self.del-file($file);
}