about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-16 01:04:28 +0000
committerEric Wong <e@80x24.org>2019-06-16 01:04:28 +0000
commitc477bdd8a80eecc319b680764edfb24bd12cb7b2 (patch)
treefb36e978b8dbe1f2228527891d47ef9d69b10591 /lib/PublicInbox/SearchIdx.pm
parent044b1d03c76246316d52de4bfd578745a8192398 (diff)
parent27658d2c8b8e51fa64f523c873587273f4f16c46 (diff)
downloadpublic-inbox-c477bdd8a80eecc319b680764edfb24bd12cb7b2.tar.gz
* origin/newspeak:
  comments: replace "partition" with "shard"
  t/xcpdb-reshard: use 'shard' term in local variables
  xapcmd: favor 'shard' over 'part' in local variables
  search: use "shard" for local variable
  v2writable: use "epoch" consistently when referring to git repos
  adminedit: "part" => "shard" for local variables
  v2writable: rename local vars to match Xapian terminology
  v2writable: avoid "part" in internal subs and fields
  search*: rename {partition} => {shard}
  xapcmd: update comments referencing "partitions"
  v2: rename SearchIdxPart => SearchIdxShard
  inboxwritable: s/partitions/shards/ in local var
  tests: change messages to use "shard" instead of partition
  v2writable: rename {partitions} field to {shards}
  v2writable: count_partitions => count_shards
  searchidxpart: start using "shard" in user-visible places
  rename reference to git epochs as "partitions"
  admin|xapcmd: user-facing messages say "shard"
  v2writable: update comments regarding xcpdb --reshard
  doc: rename our Xapian "partitions" to "shards"
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r--lib/PublicInbox/SearchIdx.pm19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index a088ce75..665f673a 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -29,7 +29,7 @@ use constant {
 my $xapianlevels = qr/\A(?:full|medium)\z/;
 
 sub new {
-        my ($class, $ibx, $creat, $part) = @_;
+        my ($class, $ibx, $creat, $shard) = @_;
         ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
         my $levels = qr/\A(?:full|medium|basic)\z/;
         my $mainrepo = $ibx->{mainrepo};
@@ -62,9 +62,9 @@ sub new {
                 my $dir = $self->xdir;
                 $self->{over} = PublicInbox::OverIdx->new("$dir/over.sqlite3");
         } elsif ($version == 2) {
-                defined $part or die "partition is required for v2\n";
-                # partition is a number
-                $self->{partition} = $part;
+                defined $shard or die "shard is required for v2\n";
+                # shard is a number
+                $self->{shard} = $shard;
                 $self->{lock_path} = undef;
         } else {
                 die "unsupported inbox version=$version\n";
@@ -102,8 +102,8 @@ sub _xdb_acquire {
                 $self->lock_acquire;
 
                 # don't create empty Xapian directories if we don't need Xapian
-                my $is_part = defined($self->{partition});
-                if (!$is_part || ($is_part && need_xapian($self))) {
+                my $is_shard = defined($self->{shard});
+                if (!$is_shard || ($is_shard && need_xapian($self))) {
                         File::Path::mkpath($dir);
                 }
         }
@@ -797,7 +797,7 @@ sub remote_close {
 sub remote_remove {
         my ($self, $oid, $mid) = @_;
         if (my $w = $self->{w}) {
-                # triggers remove_by_oid in a partition
+                # triggers remove_by_oid in a shard
                 print $w "D $oid $mid\n" or die "failed to write remove $!";
         } else {
                 $self->begin_txn_lazy;
@@ -824,9 +824,10 @@ sub commit_txn_lazy {
         $self->{-inbox}->with_umask(sub {
                 if (my $xdb = $self->{xdb}) {
 
-                        # store 'indexlevel=medium' in v2 part=0 and v1 (only part)
+                        # store 'indexlevel=medium' in v2 shard=0 and
+                        # v1 (only one shard)
                         # This metadata is read by Admin::detect_indexlevel:
-                        if (!$self->{partition} # undef or 0, not >0
+                        if (!$self->{shard} # undef or 0, not >0
                             && $self->{indexlevel} eq 'medium') {
                                 $xdb->set_metadata('indexlevel', 'medium');
                         }