+ my ($class, $ibx, $creat_opt) = @_;
+ my $self = bless $ibx, $class;
+
+ # TODO: maybe stop supporting this
+ if ($creat_opt) { # for { nproc => $N }
+ $self->{-creat_opt} = $creat_opt;
+ init_inbox($self) if $self->version == 1;
+ }
+ $self;
+}
+
+sub assert_usable_dir {
+ my ($self) = @_;
+ my $dir = $self->{inboxdir};
+ return $dir if defined($dir) && $dir ne '';
+ die "no inboxdir defined for $self->{name}\n";
+}
+
+sub init_inbox {
+ my ($self, $shards, $skip_epoch, $skip_artnum) = @_;
+ # TODO: honor skip_artnum
+ if ($self->version == 1) {
+ my $dir = assert_usable_dir($self);
+ PublicInbox::Import::init_bare($dir);
+ } else {
+ my $v2w = importer($self);
+ $v2w->init_inbox($shards, $skip_epoch, $skip_artnum);
+ }