* [PATCH 04/20] rename reference to git epochs as "partitions"
2019-06-15 8:46 7% [PATCH 00/20] v2: use consistent terminology Eric Wong
@ 2019-06-15 8:47 5% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-06-15 8:47 UTC (permalink / raw)
To: meta
Try to remain consistent with our own documentation regarding
v2 git "epochs", first.
---
lib/PublicInbox/Inbox.pm | 18 +++++++++---------
lib/PublicInbox/WWW.pm | 12 ++++++------
lib/PublicInbox/WwwListing.pm | 2 +-
lib/PublicInbox/WwwStream.pm | 12 ++++++------
t/view.t | 2 +-
5 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 10f716c..c0eb640 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -125,11 +125,11 @@ sub new {
bless $opts, $class;
}
-sub git_part {
- my ($self, $part) = @_;
+sub git_epoch {
+ my ($self, $epoch) = @_;
($self->{version} || 1) == 2 or return;
- $self->{"$part.git"} ||= eval {
- my $git_dir = "$self->{mainrepo}/git/$part.git";
+ $self->{"$epoch.git"} ||= eval {
+ my $git_dir = "$self->{mainrepo}/git/$epoch.git";
my $g = PublicInbox::Git->new($git_dir);
$g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
# no cleanup needed, we never cat-file off this, only clone
@@ -149,13 +149,13 @@ sub git {
};
}
-sub max_git_part {
+sub max_git_epoch {
my ($self) = @_;
my $v = $self->{version};
return unless defined($v) && $v == 2;
- my $part = $self->{-max_git_part};
+ my $cur = $self->{-max_git_epoch};
my $changed = git($self)->alternates_changed;
- if (!defined($part) || $changed) {
+ if (!defined($cur) || $changed) {
$self->git->cleanup if $changed;
my $gits = "$self->{mainrepo}/git";
if (opendir my $dh, $gits) {
@@ -164,12 +164,12 @@ sub max_git_part {
$git_dir =~ m!\A([0-9]+)\.git\z! or next;
$max = $1 if $1 > $max;
}
- $part = $self->{-max_git_part} = $max if $max >= 0;
+ $cur = $self->{-max_git_epoch} = $max if $max >= 0;
} else {
warn "opendir $gits failed: $!\n";
}
}
- $part;
+ $cur;
}
sub mm {
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index e468263..9021cb5 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -76,9 +76,9 @@ sub call {
if ($method eq 'POST') {
if ($path_info =~ m!$INBOX_RE/(?:(?:git/)?([0-9]+)(?:\.git)?/)?
(git-upload-pack)\z!x) {
- my ($part, $path) = ($2, $3);
+ my ($epoch, $path) = ($2, $3);
return invalid_inbox($ctx, $1) ||
- serve_git($ctx, $part, $path);
+ serve_git($ctx, $epoch, $path);
} elsif ($path_info =~ m!$INBOX_RE/!o) {
return invalid_inbox($ctx, $1) || mbox_results($ctx);
}
@@ -100,8 +100,8 @@ sub call {
invalid_inbox($ctx, $1) || get_new($ctx);
} elsif ($path_info =~ m!$INBOX_RE/(?:(?:git/)?([0-9]+)(?:\.git)?/)?
($PublicInbox::GitHTTPBackend::ANY)\z!ox) {
- my ($part, $path) = ($2, $3);
- invalid_inbox($ctx, $1) || serve_git($ctx, $part, $path);
+ my ($epoch, $path) = ($2, $3);
+ invalid_inbox($ctx, $1) || serve_git($ctx, $epoch, $path);
} elsif ($path_info =~ m!$INBOX_RE/([a-zA-Z0-9_\-]+).mbox\.gz\z!o) {
serve_mbox_range($ctx, $1, $2);
} elsif ($path_info =~ m!$INBOX_RE/$MID_RE/$END_RE\z!o) {
@@ -437,10 +437,10 @@ sub msg_page {
}
sub serve_git {
- my ($ctx, $part, $path) = @_;
+ my ($ctx, $epoch, $path) = @_;
my $env = $ctx->{env};
my $ibx = $ctx->{-inbox};
- my $git = defined $part ? $ibx->git_part($part) : $ibx->git;
+ my $git = defined $epoch ? $ibx->git_epoch($epoch) : $ibx->git;
$git ? PublicInbox::GitHTTPBackend::serve($env, $git, $path) : r404();
}
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index e2724cc..e052bbf 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -190,7 +190,7 @@ sub js ($$) {
my $manifest = { -abs2urlpath => {}, -mtime => 0 };
for my $ibx (@$list) {
- if (defined(my $max = $ibx->max_git_part)) {
+ if (defined(my $max = $ibx->max_git_epoch)) {
for my $epoch (0..$max) {
manifest_add($manifest, $ibx, $epoch);
}
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index f6c5049..082e5ec 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -85,11 +85,11 @@ sub _html_end {
my (%seen, @urls);
my $http = $ibx->base_url($ctx->{env});
chop $http; # no trailing slash for clone
- my $part = $ibx->max_git_part;
+ my $max = $ibx->max_git_epoch;
my $dir = (split(m!/!, $http))[-1];
- if (defined($part)) { # v2
+ if (defined($max)) { # v2
$seen{$http} = 1;
- for my $i (0..$part) {
+ for my $i (0..$max) {
# old parts my be deleted:
-d "$ibx->{mainrepo}/git/$i.git" or next;
my $url = "$http/$i";
@@ -101,7 +101,7 @@ sub _html_end {
push @urls, $http;
}
- # FIXME: partitioning in can be different in other repositories,
+ # FIXME: epoch splits can be different in other repositories,
# use the "cloneurl" file as-is for now:
foreach my $u (@{$ibx->cloneurl}) {
next if $seen{$u};
@@ -109,13 +109,13 @@ sub _html_end {
push @urls, $u =~ /\Ahttps?:/ ? qq(<a\nhref="$u">$u</a>) : $u;
}
- if (defined($part) || scalar(@urls) > 1) {
+ if (defined($max) || scalar(@urls) > 1) {
$urls .= "\n" .
join("\n", map { "\tgit clone --mirror $_" } @urls);
} else {
$urls .= " git clone --mirror $urls[0]";
}
- if (defined $part) {
+ if (defined $max) {
my $addrs = $ibx->{address};
$addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
$urls .= <<EOF
diff --git a/t/view.t b/t/view.t
index 0782954..d93be6f 100644
--- a/t/view.t
+++ b/t/view.t
@@ -18,7 +18,7 @@ my $ctx = {
base_url => sub { 'http://example.com/' },
cloneurl => sub {[]},
nntp_url => sub {[]},
- max_git_part => sub { undef },
+ max_git_epoch => sub { undef },
description => sub { '' }),
www => Plack::Util::inline_object(style => sub { '' }),
};
--
EW
^ permalink raw reply related [relevance 5%]
* [PATCH 00/20] v2: use consistent terminology
@ 2019-06-15 8:46 7% Eric Wong
2019-06-15 8:47 5% ` [PATCH 04/20] rename reference to git epochs as "partitions" Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-06-15 8:46 UTC (permalink / raw)
To: meta
Modern Xapian docs and code refer to multi-DB uses as "shards";
so replace the term "partition" with the term "shard". This
way, we'll minimize the learning curve for people new to
public-inbox or Xapian.
We also still had a few places where we referred to git epochs
as "partitions", so fix those up and be consistent with the
majority of our own docs and code.
Eric Wong (20):
doc: rename our Xapian "partitions" to "shards"
v2writable: update comments regarding xcpdb --reshard
admin|xapcmd: user-facing messages say "shard"
rename reference to git epochs as "partitions"
searchidxpart: start using "shard" in user-visible places
v2writable: count_partitions => count_shards
v2writable: rename {partitions} field to {shards}
tests: change messages to use "shard" instead of partition
inboxwritable: s/partitions/shards/ in local var
v2: rename SearchIdxPart => SearchIdxShard
xapcmd: update comments referencing "partitions"
search*: rename {partition} => {shard}
v2writable: avoid "part" in internal subs and fields
v2writable: rename local vars to match Xapian terminology
adminedit: "part" => "shard" for local variables
v2writable: use "epoch" consistently when referring to git repos
search: use "shard" for local variable
xapcmd: favor 'shard' over 'part' in local variables
t/xcpdb-reshard: use 'shard' term in local variables
comments: replace "partition" with "shard"
Documentation/public-inbox-v2-format.pod | 10 +-
Documentation/public-inbox-xcpdb.pod | 11 +-
MANIFEST | 2 +-
lib/PublicInbox/Admin.pm | 4 +-
lib/PublicInbox/AdminEdit.pm | 12 +-
lib/PublicInbox/Inbox.pm | 18 +--
lib/PublicInbox/InboxWritable.pm | 4 +-
lib/PublicInbox/Search.pm | 14 +--
lib/PublicInbox/SearchIdx.pm | 19 +--
.../{SearchIdxPart.pm => SearchIdxShard.pm} | 30 ++---
lib/PublicInbox/V2Writable.pm | 109 +++++++++---------
lib/PublicInbox/WWW.pm | 12 +-
lib/PublicInbox/WwwListing.pm | 2 +-
lib/PublicInbox/WwwStream.pm | 12 +-
lib/PublicInbox/Xapcmd.pm | 96 +++++++--------
t/indexlevels-mirror.t | 2 +-
t/psgi_v2.t | 2 +-
t/v2writable.t | 4 +-
t/view.t | 2 +-
t/xcpdb-reshard.t | 14 +--
20 files changed, 188 insertions(+), 191 deletions(-)
rename lib/PublicInbox/{SearchIdxPart.pm => SearchIdxShard.pm} (78%)
--
EW
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-06-15 8:46 7% [PATCH 00/20] v2: use consistent terminology Eric Wong
2019-06-15 8:47 5% ` [PATCH 04/20] rename reference to git epochs as "partitions" Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).