From 1218a4126807951a0f47286338dc04d7f197bb78 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 20 Mar 2020 08:18:18 +0000 Subject: *idx: pass $smsg in more places instead of many args We can pass blessed PublicInbox::Smsg objects to internal indexing APIs instead of having long parameter lists in some places. The end goal is to avoid parsing redundant information each step of the way and hopefully make things more understandable. --- lib/PublicInbox/SearchIdxShard.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/SearchIdxShard.pm') diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index 74c624a4..d29e6090 100644 --- a/lib/PublicInbox/SearchIdxShard.pm +++ b/lib/PublicInbox/SearchIdxShard.pm @@ -76,7 +76,13 @@ sub shard_worker_loop ($$$$$) { $artnum = int($artnum); $self->{autime} = $autime; $self->{cotime} = $cotime; - $self->add_message($mime, $n, $artnum, $oid, $mid0); + my $smsg = bless { + bytes => $len, + num => $artnum, + blob => $oid, + mid => $mid0, + }, 'PublicInbox::Smsg'; + $self->add_message($mime, $smsg); } } $self->worker_done; @@ -95,7 +101,13 @@ sub index_raw { $self->begin_txn_lazy; $self->{autime} = $at; $self->{cotime} = $ct; - $self->add_message($mime, $bytes, $artnum, $oid, $mid0); + my $smsg = bless { + bytes => $bytes, + num => $artnum, + blob => $oid, + mid => $mid0, + }, 'PublicInbox::Smsg'; + $self->add_message($mime, $smsg); } } -- cgit v1.2.3-24-ge0c7