about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-17 15:39:22 +0600
committerEric Wong <e@80x24.org>2021-03-17 19:03:15 +0000
commit86f7b16ee50081d4eed779372ccc198d8a1770dc (patch)
tree6af5a9310cce2ceace5bcc431f0adb93b1b57945 /t
parent4c6c853494b4936825741bb5e8885f1312639058 (diff)
downloadpublic-inbox-86f7b16ee50081d4eed779372ccc198d8a1770dc.tar.gz
lei_store: keywords => vmd (volatile metadata), prepare for labels
Since keywords and mailboxes (AKA labels) are separate things in
JMAP; and only keywords can map reliably to Maildir and mbox;
we'll keep them separate in our internal data representations,
too.

I initially wanted to call this just "meta" for "metadata", but
that might be confused with our mailing list name.  "metadata"
is already used in Xapian's own API, to add another layer of
confusion.

"tags" was also considered, but probably confusing to notmuch
users since our "labels" are analogous to "tags" in notmuch,
and notmuch doesn't seem to cover "keywords" separately...

So "vmd" it is, since we haven't used this particular
three-letter-abbreviation anywhere before; and "volatile" seems
like a good description of this metadata since everything else
up to this point has been mostly WORM (write-once, read-many).
Diffstat (limited to 't')
-rw-r--r--t/lei_store.t28
1 files changed, 14 insertions, 14 deletions
diff --git a/t/lei_store.t b/t/lei_store.t
index d270e1f6..024ff527 100644
--- a/t/lei_store.t
+++ b/t/lei_store.t
@@ -36,37 +36,37 @@ $sto->done;
 
 for my $parallel (0, 1) {
         $sto->{priv_eidx}->{parallel} = $parallel;
-        my $docids = $sto->set_eml_keywords($eml, qw(seen draft));
+        my $docids = $sto->set_eml_vmd($eml, { kw => [ qw(seen draft) ] });
         is(scalar @$docids, 1, 'set keywords on one doc');
         $sto->done;
         my @kw = $sto->search->msg_keywords($docids->[0]);
         is_deeply(\@kw, [qw(draft seen)], 'kw matches');
 
-        $docids = $sto->add_eml_keywords($eml, qw(seen draft));
+        $docids = $sto->add_eml_vmd($eml, {kw => [qw(seen draft)]});
         $sto->done;
         is(scalar @$docids, 1, 'idempotently added keywords to doc');
         @kw = $sto->search->msg_keywords($docids->[0]);
         is_deeply(\@kw, [qw(draft seen)], 'kw matches after noop');
 
-        $docids = $sto->remove_eml_keywords($eml, qw(seen draft));
+        $docids = $sto->remove_eml_vmd($eml, {kw => [qw(seen draft)]});
         is(scalar @$docids, 1, 'removed from one doc');
         $sto->done;
         @kw = $sto->search->msg_keywords($docids->[0]);
         is_deeply(\@kw, [], 'kw matches after remove');
 
-        $docids = $sto->remove_eml_keywords($eml, qw(answered));
+        $docids = $sto->remove_eml_vmd($eml, {kw=> [qw(answered)]});
         is(scalar @$docids, 1, 'removed from one doc (idempotently)');
         $sto->done;
         @kw = $sto->search->msg_keywords($docids->[0]);
         is_deeply(\@kw, [], 'kw matches after remove (idempotent)');
 
-        $docids = $sto->add_eml_keywords($eml, qw(answered));
+        $docids = $sto->add_eml_vmd($eml, {kw => [qw(answered)]});
         is(scalar @$docids, 1, 'added to empty doc');
         $sto->done;
         @kw = $sto->search->msg_keywords($docids->[0]);
         is_deeply(\@kw, ['answered'], 'kw matches after add');
 
-        $docids = $sto->set_eml_keywords($eml);
+        $docids = $sto->set_eml_vmd($eml, { kw => [] });
         is(scalar @$docids, 1, 'set to clobber');
         $sto->done;
         @kw = $sto->search->msg_keywords($docids->[0]);
@@ -74,11 +74,11 @@ for my $parallel (0, 1) {
 
         my $set = eml_load('t/plack-qp.eml');
         $set->header_set('Message-ID', "<set\@$parallel>");
-        my $ret = $sto->set_eml($set, 'seen');
+        my $ret = $sto->set_eml($set, { kw => [ 'seen' ] });
         is(ref $ret, 'PublicInbox::Smsg', 'initial returns smsg');
-        my $ids = $sto->set_eml($set, qw(seen));
+        my $ids = $sto->set_eml($set, { kw => [ 'seen' ] });
         is_deeply($ids, [ $ret->{num} ], 'set_eml idempotent');
-        $ids = $sto->set_eml($set, qw(seen answered));
+        $ids = $sto->set_eml($set, { kw => [ qw(seen answered) ] });
         is_deeply($ids, [ $ret->{num} ], 'set_eml to change kw');
         $sto->done;
         @kw = $sto->search->msg_keywords($ids->[0]);
@@ -91,23 +91,23 @@ SKIP: {
         $eml->header_set('Message-ID', '<ipc-test@example>');
         my $pid = $sto->ipc_worker_spawn('lei-store');
         ok($pid > 0, 'got a worker');
-        my $smsg = $sto->ipc_do('set_eml', $eml, qw(seen));
+        my $smsg = $sto->ipc_do('set_eml', $eml, { kw => [ qw(seen) ] });
         is(ref($smsg), 'PublicInbox::Smsg', 'set_eml works over ipc');
-        my $ids = $sto->ipc_do('set_eml', $eml, qw(seen));
+        my $ids = $sto->ipc_do('set_eml', $eml, { kw => [ qw(seen) ] });
         is_deeply($ids, [ $smsg->{num} ], 'docid returned');
 
         $eml->header_set('Message-ID');
-        my $no_mid = $sto->ipc_do('set_eml', $eml, qw(seen));
+        my $no_mid = $sto->ipc_do('set_eml', $eml, { kw => [ qw(seen) ] });
         my $wait = $sto->ipc_do('done');
         my @kw = $sto->search->msg_keywords($no_mid->{num});
         is_deeply(\@kw, [qw(seen)], 'ipc set changed kw');
 
         is(ref($smsg), 'PublicInbox::Smsg', 'no mid works ipc');
-        $ids = $sto->ipc_do('set_eml', $eml, qw(seen));
+        $ids = $sto->ipc_do('set_eml', $eml, { kw => [ qw(seen) ] });
         is_deeply($ids, [ $no_mid->{num} ], 'docid returned w/o mid w/ ipc');
         $sto->ipc_do('done');
         $sto->ipc_worker_stop;
-        $ids = $sto->ipc_do('set_eml', $eml, qw(seen answered));
+        $ids = $sto->ipc_do('set_eml', $eml, { kw => [ qw(seen answered) ] });
         is_deeply($ids, [ $no_mid->{num} ], 'docid returned w/o mid w/o ipc');
         $wait = $sto->ipc_do('done');