AnyEvent-PgRecvlogical

 view release on metacpan or  search on metacpan

lib/AnyEvent/PgRecvlogical.pm  view on Meta::CPAN

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
=back
 
=item C<username>
 
=over
 
=item L<Str|Types::Standard/Str>
 
=back
 
=item C<password>
 
=over
 
=item L<Str|Types::Standard/Str>
 
=back
 
Standard PostgreSQL connection parameters, see L<DBD::Pg/connect>.
 
=item C<do_create_slot>

lib/AnyEvent/PgRecvlogical.pm  view on Meta::CPAN

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
the payload. Once it is released, the server will be informed that the WAL position has been "flushed."
 
=back
 
=cut
 
has dbname   => (is => 'ro', isa => Str, required  => 1);
has host     => (is => 'ro', isa => Str, predicate => 1);
has port     => (is => 'ro', isa => Int, predicate => 1);
has username => (is => 'ro', isa => Str, default   => q{});
has password => (is => 'ro', isa => Str, default   => q{});
has slot     => (is => 'ro', isa => Str, required  => 1);
 
has dbh                => (is => 'lazy', isa => $DBH, clearer => 1, init_arg => undef);
has do_create_slot     => (is => 'ro',   isa => Bool,    default   => 0);
has slot_exists_ok     => (is => 'ro',   isa => Bool,    default   => 0);
has reconnect          => (is => 'ro',   isa => Bool,    default   => 1);
has reconnect_delay    => (is => 'ro',   isa => Int,     default   => 5);
has reconnect_limit    => (is => 'ro',   isa => Int,     predicate => 1);
has _reconnect_counter => (is => 'rw',   isa => Int,     default   => 0);
has heartbeat          => (is => 'ro',   isa => Int,     default   => 10);

lib/AnyEvent/PgRecvlogical.pm  view on Meta::CPAN

337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
        next if $self->can($x) and not $self->$x;
 
        $dsn{$_} = $self->$_;
    }
 
    return 'dbi:Pg:' . join q{;}, map { "$_=$dsn{$_}" } sort keys %dsn;
}
 
sub _build_dbh {
    my $self = shift;
    my $dbh  = DBI->connect($self->_dsn, $self->username, $self->password, { PrintError => 0 },);
 
    croak $DBI::errstr unless $dbh;
 
    return $dbh;
}
 
sub _build__fh_watch {
    my $self = shift;
 
    my $w = AE::io $self->dbh->{pg_socket}, 0, $self->curry::weak::_read_copydata;



( run in 1.224 second using v1.01-cache-2.11-cpan-87723dcf8b7 )