From 17f7672a2584252e72e9ef576e250b268e13e006 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 27 Dec 2019 17:17:54 +0000 Subject: types in Store --- lib/MaildirIndexer/Store.pm6 | 14 +++++++------- 1 file 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; } -- cgit v1.2.3