summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-12-27 17:17:54 +0000
committerdakkar <dakkar@thenautilus.net>2019-12-27 17:17:54 +0000
commit17f7672a2584252e72e9ef576e250b268e13e006 (patch)
treedf187d51f16adc6ce38945980ea94d5a8757e25e
parentsome fixes after manual testing (diff)
downloadMaildirIndexer-17f7672a2584252e72e9ef576e250b268e13e006.tar.gz
MaildirIndexer-17f7672a2584252e72e9ef576e250b268e13e006.tar.bz2
MaildirIndexer-17f7672a2584252e72e9ef576e250b268e13e006.zip
types in Store
-rw-r--r--lib/MaildirIndexer/Store.pm614
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;
}