Storm/Spout.pm

filter: Statementstmt 51.1% 23 / 45 Branchbran 12.5% 2 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 54.5% 6 / 11 Podpod 100% 6 / 6 totaltotal 47.4% 37 / 78 CC 9 SCAR 23.0
CC
9
Cov
41%
run
20.0
emit
16.0
initialize
2.0
CRAP 9.9
« Storm/Component.pm ↑ Summary Storm/Bolt.pm »
1 # ABSTRACT: The base class for all IO::Storm Spout.
2  
3 package IO::Storm::Spout;
4 1 $IO::Storm::Spout::VERSION = '0.17';
5 # Imports
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 extends 'IO::Storm::Component';
14  
15  
16 0 ▶sub initialize {
Subroutine initialize: not called CC=1 SCAR=6.9
Pod documented
17 0 my ( $self, $storm_conf, $context ) = @_;
18 }
19  
20  
21 0 ▶sub ack {
Subroutine ack: not called CC=1 SCAR=6.9
Pod documented
22 0 my ( $self, $id ) = @_;
23 }
24  
25  
26 0 ▶sub fail {
Subroutine fail: not called CC=1 SCAR=6.9
Pod documented
27 0 my ( $self, $id ) = @_;
28 }
29  
30  
31 0 ▶sub next_tuple {
Subroutine next_tuple: not called CC=1 SCAR=6.9
Pod documented
32 0 my ($self) = @_;
33 }
34  
35  
36 1 ▶sub emit ($$;$) {
Subroutine emit: called CC=6 SCAR=27.7
Pod documented
37 1 my ( $self, $tuple, $args ) = @_;
38  
39 1 my $msg = { command => 'emit', tuple => $tuple };
40  
41 1 ▶ if ( defined($args) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args) 0 1 1
42 0 ▶ if ( defined( $args->{tup_id} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{"tup_id"}) 0 0 0
43 0 $msg->{id} = $args->{tup_id};
44 }
45 0 ▶ if ( defined( $args->{stream} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{"stream"}) 0 0 0
46 0 $msg->{stream} = $args->{stream};
47 }
48 0 ▶ if ( defined( $args->{direct_task} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{"direct_task"}) 0 0 0
49 0 $msg->{task} = $args->{direct_task};
50 }
51 }
52  
53 1 $self->send_message($msg);
54  
55 1 ▶ if ( defined $msg->{task} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $msg->{'task'}) { } 0 1 1
56 0 return $msg->{task};
57 }
58 else {
59 1 return $self->read_task_ids();
60 }
61 }
62  
63  
64 0 ▶sub run {
Subroutine run: not called CC=4 SCAR=30.0
Pod documented
65 0 my ($self) = @_;
66  
67 0 my ( $storm_conf, $context ) = $self->read_handshake();
68 0 $self->_setup_component( $storm_conf, $context );
69 0 $self->initialize( $storm_conf, $context );
70  
71 0 while (1) {
72 0 my $msg = $self->read_command();
73 0 ▶ if ( $msg->{command} eq 'next' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($msg->{'command'} eq 'next') { } 0 0 0
elsif ($msg->{'command'} eq 'ack') { } 0 0 0
elsif ($msg->{'command'} eq 'fail') { } 0 0 0
74 0 $self->next_tuple;
75 }
76 elsif ( $msg->{command} eq 'ack' ) {
77 0 $self->ack( $msg->{id} );
78 }
79 elsif ( $msg->{command} eq 'fail' ) {
80 0 $self->fail( $msg->{id} );
81 }
82 0 $self->sync();
83 }
84 }
85  
86 1 1;
87  
88 __END__
« Storm/Component.pm ↑ Summary Storm/Bolt.pm »