]> Sergey Matveev's repositories - public-inbox.git/commitdiff
over: rename ->disconnect to ->dbh_close
authorEric Wong <e@yhbt.net>
Wed, 26 Aug 2020 08:17:39 +0000 (08:17 +0000)
committerEric Wong <e@yhbt.net>
Thu, 27 Aug 2020 10:57:25 +0000 (10:57 +0000)
Since we got rid of over->connect, `disconnect' no longer pairs
with it.  So name it after the `close(2)' syscall it ultimately
issues.

lib/PublicInbox/Over.pm
lib/PublicInbox/OverIdx.pm
lib/PublicInbox/V2Writable.pm
t/over.t

index 0ebc800314888827ea8778232cccc43aa6f5b6ee..a2cf9f217a88506e1dbe0f8bdf3d952ebaa888ec 100644 (file)
@@ -72,7 +72,7 @@ sub new {
        bless { filename => $f }, $class;
 }
 
-sub disconnect {
+sub dbh_close {
        my ($self) = @_;
        if (my $dbh = delete $self->{dbh}) {
                delete $self->{-get_art};
@@ -328,7 +328,7 @@ sub check_inodes {
                my $st = pack('dd', $st[0], $st[1]);
 
                # don't actually reopen, just let {dbh} be recreated later
-               disconnect($self) if $st ne ($self->{st} // $st);
+               dbh_close($self) if $st ne ($self->{st} // $st);
        } else {
                warn "W: stat $f: $!\n";
        }
index c521464a7447cc5725f7c5db11b6bde56493cd34..512c5f463f008f0c3e3532ccd803e2d7ca54fc69 100644 (file)
@@ -455,10 +455,10 @@ sub rollback_lazy {
        $self->{dbh}->rollback;
 }
 
-sub disconnect {
+sub dbh_close {
        my ($self) = @_;
        die "in transaction" if $self->{txn};
-       $self->SUPER::disconnect;
+       $self->SUPER::dbh_close;
 }
 
 sub create {
@@ -470,7 +470,7 @@ sub create {
        }
        # create the DB:
        PublicInbox::Over::dbh($self);
-       $self->disconnect;
+       $self->dbh_close;
 }
 
 sub rethread_prepare {
index c926446c87ef0697057fdf1973228891ce2a8194..f2288904638e98e147af30bc68a1678a5dcda7f7 100644 (file)
@@ -679,8 +679,8 @@ sub done {
                        $err .= "shard close: $@\n" if $@;
                }
        }
-       eval { $self->{over}->disconnect };
-       $err .= "over disconnect: $@\n" if $@;
+       eval { $self->{over}->dbh_close };
+       $err .= "over close: $@\n" if $@;
        delete $self->{bnote};
        my $nbytes = $self->{total_bytes};
        $self->{total_bytes} = 0;
index 6c4c8ee6b0b356b39d7facdf64b03dc63f740f1f..41c13872c4e94095cede8b3eddd08e839a7085c7 100644 (file)
--- a/t/over.t
+++ b/t/over.t
@@ -23,7 +23,7 @@ $y = $over->sid('hello-WORLD');
 is($y, $x+1, 'sid increases');
 is($over->sid('hello-world'), $x, 'idempotent');
 ok(!$over->{dbh}->{ReadOnly}, 'OverIdx is not ReadOnly');
-$over->disconnect;
+$over->dbh_close;
 
 $over = PublicInbox::Over->new("$tmpdir/over.sqlite3");
 ok($over->dbh->{ReadOnly}, 'Over is ReadOnly');