line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1028
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
65
|
|
3
|
|
|
|
|
|
|
package CPAN::Testers::Metabase::MongoDB; |
4
|
|
|
|
|
|
|
# ABSTRACT: Metabase backend on MongoDB |
5
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
584
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Metabase::Archive::MongoDB 1.000; |
9
|
|
|
|
|
|
|
use Metabase::Index::MongoDB 1.000; |
10
|
|
|
|
|
|
|
use Metabase::Librarian 1.000; |
11
|
|
|
|
|
|
|
use namespace::autoclean; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Metabase::Gateway'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'db_prefix' => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => 'Str', |
18
|
|
|
|
|
|
|
required => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has 'host' => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
isa => 'Str', |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _build_fact_classes { return [qw/CPAN::Testers::Report/] } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _build_public_librarian { return $_[0]->__build_librarian("public") } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _build_private_librarian { return $_[0]->__build_librarian("private") } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub __build_librarian { |
34
|
|
|
|
|
|
|
my ($self, $subspace) = @_; |
35
|
|
|
|
|
|
|
my $db_prefix = $self->db_prefix; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
return Metabase::Librarian->new( |
38
|
|
|
|
|
|
|
archive => Metabase::Archive::MongoDB->new( |
39
|
|
|
|
|
|
|
db_name => "${db_prefix}_${subspace}", |
40
|
|
|
|
|
|
|
host => $self->host, |
41
|
|
|
|
|
|
|
), |
42
|
|
|
|
|
|
|
index => Metabase::Index::MongoDB->new( |
43
|
|
|
|
|
|
|
db_name => "${db_prefix}_${subspace}", |
44
|
|
|
|
|
|
|
host => $self->host, |
45
|
|
|
|
|
|
|
), |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
CPAN::Testers::Metabase::MongoDB - Metabase backend on MongoDB |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
version 0.001 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SYNOPSIS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 Direct usage |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
use CPAN::Testers::Metabase::MongoDB; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $mb = CPAN::Testers::Metabase::MongoDB->new( |
71
|
|
|
|
|
|
|
db_prefix => "my_metabase", |
72
|
|
|
|
|
|
|
host => "mongodb://localhost:27017", |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
$mb->public_librarian->search( %search spec ); |
76
|
|
|
|
|
|
|
... |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 Metabase::Web config |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
--- |
81
|
|
|
|
|
|
|
Model::Metabase: |
82
|
|
|
|
|
|
|
class: CPAN::Testers::Metabase::MongoDB |
83
|
|
|
|
|
|
|
args: |
84
|
|
|
|
|
|
|
db_prefix: my_metabase |
85
|
|
|
|
|
|
|
host: "mongodb://localhost:27017/" |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DESCRIPTION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This class instantiates a Metabase backend that uses MongoDB for storage and |
90
|
|
|
|
|
|
|
indexing. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 USAGE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 new |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $mb = CPAN::Testers::Metabase::MongoDB->new( |
97
|
|
|
|
|
|
|
db_prefix => "my_metabase", |
98
|
|
|
|
|
|
|
host => "mongodb://localhost:27017", |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Arguments for C<<< new >>>: |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
C<<< db_prefix >>> -- required -- a unique namespace for the collections |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
C<<< host >>> -- required -- a MongoDB connection string |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 Metabase::Gateway Role |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This class does the L<Metabase::Gateway> role, including the following |
118
|
|
|
|
|
|
|
methods: |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=over |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
C<<< handle_submission >>> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
C<<< handle_registration >>> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
C<<< enqueue >>> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
see L<Metabase::Gateway> for more. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 SEE ALSO |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=over |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L<CPAN::Testers::Metabase> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
L<Metabase::Gateway> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L<Metabase::Web> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
L<Net::Amazon::Config> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=back |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 SUPPORT |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
167
|
|
|
|
|
|
|
at L<http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Testers-Metabase-MongoDB>. |
168
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 Source Code |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
173
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L<https://github.com/dagolden/cpan-testers-metabase-mongodb> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
git clone https://github.com/dagolden/cpan-testers-metabase-mongodb.git |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 AUTHOR |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
David Golden <dagolden@cpan.org> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by David Golden. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This is free software, licensed under: |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
__END__ |
195
|
|
|
|
|
|
|
|