diff options
author | dakkar <dakkar@thenautilus.net> | 2019-12-27 17:17:54 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2019-12-27 17:17:54 +0000 |
commit | 17f7672a2584252e72e9ef576e250b268e13e006 (patch) | |
tree | df187d51f16adc6ce38945980ea94d5a8757e25e /lib | |
parent | some fixes after manual testing (diff) | |
download | MaildirIndexer-17f7672a2584252e72e9ef576e250b268e13e006.tar.gz MaildirIndexer-17f7672a2584252e72e9ef576e250b268e13e006.tar.bz2 MaildirIndexer-17f7672a2584252e72e9ef576e250b268e13e006.zip |
types in Store
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MaildirIndexer/Store.pm6 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/MaildirIndexer/Store.pm6 b/lib/MaildirIndexer/Store.pm6 index dbe2343..41dc314 100644 --- a/lib/MaildirIndexer/Store.pm6 +++ b/lib/MaildirIndexer/Store.pm6 @@ -8,14 +8,14 @@ has MaildirIndexer::Index @.indices is required; has Channel $.file-channel is required; has Int $.workers = 10; -method dump() { +method dump(--> Nil) { $!lock.protect: { .dump() for @!indices; } } -method start() { - for ^10 { +method start(--> Nil) { + for ^$.workers { start react { CATCH { warn .perl }; whenever $.file-channel -> $file { @@ -30,7 +30,7 @@ method start() { } } -method add-file(IO:D $file) { +method add-file(IO:D $file --> Nil) { my $mailbox = mailbox-from-path($file.path) or return; my $email = parse-email($file,:headers-only) or return; CATCH { warn .perl }; @@ -40,7 +40,7 @@ method add-file(IO:D $file) { return; } -method del-file(IO:D $file) { +method del-file(IO:D $file --> Nil) { my $mailbox = mailbox-from-path($file.path) or return; $!lock.protect: { .del-path($file,$mailbox) for @!indices; @@ -48,14 +48,14 @@ method del-file(IO:D $file) { return; } -method mailbox-for-email(MaildirIndexer::Email:D $email) { +method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) { for @!indices -> $index { with $index.mailbox-for-email($email) { return $_ }; } return Nil; } -sub mailbox-from-path(Str() $path) { +sub mailbox-from-path(Str() $path --> Str) { $path ~~ m{'/' (<-[/]>+?) '/' [cur|new|tmp] '/'} and return ~$/[0]; return Nil; } |