| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package KiokuDB::Cmd::TXN; | ||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use namespace::clean -except => 'meta'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | requires "v"; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | has _txn => ( | |||||||||||||||||||||||||||
| 11 | traits => [qw(NoGetopt)], | ||||||||||||||||||||||||||||
| 12 | is => "rw", | ||||||||||||||||||||||||||||
| 13 | clearer => "_clear_txn", | ||||||||||||||||||||||||||||
| 14 | predicate => "_has_txn", | ||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub try_txn_begin { | ||||||||||||||||||||||||||
|
Subroutine
try_txn_begin: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 0 | my ( $self, $b ) = @_; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | if ( $b->does("KiokuDB::Backend::Role::TXN") ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | $self->v("starting transaction\n"); | |||||||||||||||||||||||||||
| 22 | 0 | $self->_txn( $b->txn_begin ); | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 2 | ▶ | sub try_txn_commit { | ||||||||||||||||||||||||||
|
Subroutine
try_txn_commit: called CC=4 SCAR=25.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 2 | my ( $self, $b ) = @_; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | ▶ | if ( $self->_has_txn ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | my $txn = $self->_txn; | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ( $self->can("dry_run") and $self->dry_run ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->can("dry_run") and $self->dry_run
MC/DC0%0/2
$self->can("dry_run") and $self->dry_run
$self->can("dry_run")
$self->dry_run
Truth table0%0/3
A and B
A= $self->can("dry_run")B= $self->dry_run
| |||||||||||||||||||||||||||||
| 32 | 0 | $self->v("rolling back transaction..."); | |||||||||||||||||||||||||||
| 33 | 0 | $b->txn_rollback($txn); | |||||||||||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||||||||||
| 35 | 0 | $self->v("comitting transaction..."); | |||||||||||||||||||||||||||
| 36 | 0 | $b->txn_commit($txn); | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | 0 | $self->_clear_txn; | |||||||||||||||||||||||||||
| 39 | 0 | $self->v(" done\n"); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 1 | __PACKAGE__ | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||