| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::Riak::Fast::MapReduce::Phase::Map; |
|
2
|
22
|
|
|
22
|
|
13614
|
use Mouse; |
|
|
22
|
|
|
|
|
65
|
|
|
|
22
|
|
|
|
|
123
|
|
|
3
|
22
|
|
|
22
|
|
6352
|
use Mouse::Util::TypeConstraints; |
|
|
22
|
|
|
|
|
45
|
|
|
|
22
|
|
|
|
|
197
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
22
|
|
|
22
|
|
3349
|
use JSON::XS (); |
|
|
22
|
|
|
|
|
9220
|
|
|
|
22
|
|
|
|
|
8622
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Map phase of a MapReduce |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with ('Data::Riak::Fast::MapReduce::Phase'); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
A map/reduce map phase for Data::Riak::Fast |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $mp = Data::Riak::Fast::MapReduce::Phase::Map->new( |
|
18
|
|
|
|
|
|
|
language => "javascript", # The default |
|
19
|
|
|
|
|
|
|
source => "function(v) { return [ v ] }", |
|
20
|
|
|
|
|
|
|
keep => 1 # The default |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 keep |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Flag controlling whether the results of this phase are included in the final |
|
26
|
|
|
|
|
|
|
result of the map/reduce. Defaults to true. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 language |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The language used with this phase. One of C or C. This |
|
31
|
|
|
|
|
|
|
attribute is required. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has language => ( |
|
36
|
|
|
|
|
|
|
is => 'ro', |
|
37
|
|
|
|
|
|
|
isa => enum([qw(javascript erlang)]), |
|
38
|
|
|
|
|
|
|
required => 1 |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 name |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The name, used with built-in functions provided by Riak such as |
|
44
|
|
|
|
|
|
|
C. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has name => ( |
|
49
|
|
|
|
|
|
|
is => 'ro', |
|
50
|
|
|
|
|
|
|
isa => 'Str', |
|
51
|
|
|
|
|
|
|
predicate => 'has_name' |
|
52
|
|
|
|
|
|
|
); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has phase => ( |
|
55
|
|
|
|
|
|
|
is => 'ro', |
|
56
|
|
|
|
|
|
|
isa => 'Str', |
|
57
|
|
|
|
|
|
|
default => 'map' |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 arg |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The static argument passed to the map function. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has arg => ( |
|
67
|
|
|
|
|
|
|
is => 'ro', |
|
68
|
|
|
|
|
|
|
isa => 'Str|HashRef', |
|
69
|
|
|
|
|
|
|
predicate => 'has_arg' |
|
70
|
|
|
|
|
|
|
); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 module |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The module name, if you are using a riak built-in function. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
has module => ( |
|
79
|
|
|
|
|
|
|
is => 'ro', |
|
80
|
|
|
|
|
|
|
isa => 'Str', |
|
81
|
|
|
|
|
|
|
predicate => 'has_module' |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 function |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
The function name, if you are using a riak built-in function. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
has function => ( |
|
91
|
|
|
|
|
|
|
is => 'ro', |
|
92
|
|
|
|
|
|
|
isa => 'Str', |
|
93
|
|
|
|
|
|
|
predicate => 'has_function' |
|
94
|
|
|
|
|
|
|
); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 source |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The source of the function used in this phase. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
has source => ( |
|
103
|
|
|
|
|
|
|
is => 'ro', |
|
104
|
|
|
|
|
|
|
isa => 'Str', |
|
105
|
|
|
|
|
|
|
predicate => 'has_source' |
|
106
|
|
|
|
|
|
|
); |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 METHOD |
|
109
|
|
|
|
|
|
|
=head2 pack() |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Serialize this map phase. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub pack { |
|
116
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my $href = {}; |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
$href->{keep} = $self->keep ? JSON::XS::true() : JSON::XS::false() if $self->has_keep; |
|
|
|
0
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
$href->{language} = $self->language; |
|
122
|
0
|
0
|
|
|
|
|
$href->{name} = $self->name if $self->has_name; |
|
123
|
0
|
0
|
|
|
|
|
$href->{source} = $self->source if $self->has_source; |
|
124
|
0
|
0
|
|
|
|
|
$href->{module} = $self->module if $self->has_module; |
|
125
|
0
|
0
|
|
|
|
|
$href->{function} = $self->function if $self->has_function; |
|
126
|
0
|
0
|
|
|
|
|
$href->{arg} = $self->arg if $self->has_arg; |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
$href; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |