lib/Langertha/Skeid/CustomerSource.pm

filter: Statementstmt 98.2% 331 / 337 Branchbran 85.0% 170 / 200 Conditioncond 72.4% 84 / 116 MC/DCmcdc 53.1% 34 / 64 Subroutinesub 92.5% 50 / 54 Podpod 91.6% 11 / 12 totaltotal 86.8% 680 / 783 CC 148 SCAR 23.9
CC
148
Cov
90%
normalize_config
24.2
merge_into
21.1
_done
16.5
CRAP 10.9
« lib/Langertha/Skeid/Protocol/Documents.pm ↑ Summary lib/Langertha/Skeid/Protocol/Realtime.pm »
1 package Langertha::Skeid::CustomerSource;
2 128 our $VERSION = '0.005';
3 # ABSTRACT: Customer keys from a database relation - the section, the row contract, the fetch loop
4 128 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 128 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 128 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 128 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 128 ▶use Digest::SHA qw(sha256_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 128 ▶use JSON::MaybeXS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 128 ▶use POSIX qw(strftime);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 128 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 128 ▶use Time::HiRes ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 128 ▶use Mojo::IOLoop;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 128 ▶use Langertha::Skeid::UsageStore;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 128 ▶use Langertha::Skeid::Rate;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18 128 my @COLUMNS = qw( key_id name policy models );
19  
20 # An SQL identifier Skeid quotes itself: letters, digits and underscores, not starting with a
21 # digit, at most 63 bytes (PostgreSQL's NAMEDATALEN). Nothing a quote could break out of.
22 128 my $IDENT = qr/[A-Za-z_][A-Za-z0-9_]{0,62}/;
23  
24 128 my %KNOWN_KEYS = map { $_ => 1 } qw(
25 backend dsn host port dbname database user password_env from_usage_store
26 relation refresh_interval_s listen max_stale_s connect_timeout_s rate_column
27 );
28  
29 # The connection keys from_usage_store takes from the usage store instead.
30 128 my @OWN_CONNECTION = qw( dsn host port dbname database );
31  
32 # Longest wait between two retries of a failing fetch, as for a failing config reload.
33 128 my $BACKOFF_MAX = 60;
34  
35  
36 83 ▶sub normalize_config {
Subroutine normalize_config: called CC=24 SCAR=31.9
Pod documented
37 83 my ($class, $section, %opts) = @_;
38 83 ▶ croak 'customer_source must be a hash: backend, dsn (or host/port/dbname), user, '
Branch: 1 branch
BranchTrueFalseTotal
unless ref $section eq "HASH" 1 82 83
39 . 'password_env, relation, ...' unless ref($section) eq 'HASH';
40 82 for my $key (sort keys %$section) {
41 300 ▶ croak 'customer_source.password is not allowed: name the variable that holds it in '
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "password" 1 299 300
42 . 'password_env (ADR 0003)' if $key eq 'password';
43 croak "customer_source: unknown key '$key' (known: " . join(', ', sort keys %KNOWN_KEYS) . ')'
44 299 ▶ unless $KNOWN_KEYS{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $KNOWN_KEYS{$key} 1 298 299
45 }
46  
47 80 ▶ my $backend = lc($section->{backend} // 'postgresql');
Condition100%2/2
$section->{"backend"} // "postgresql"
l!l
179
MC/DC100%1/1
$section->{"backend"} // "postgresql"
$section->{"backend"}
Truth table100%2/2
A
A= $section->{"backend"}
Aresult
11
00
48 80 ▶ croak "customer_source.backend '$backend' is not supported (only postgresql)"
Branch: 1 branch
BranchTrueFalseTotal
unless not ref $backend and $backend =~ /\Apostgres/ 1 79 80
Condition66%2/3
not ref $backend and $backend =~ /\Apostgres/
!ll&&!rl&&r
0179
MC/DC50%1/2
not ref $backend and $backend =~ /\Apostgres/
not ref $backend $backend =~ /\Apostgres/
Truth table66%2/3
not(A) and B
A= not ref $backendB= $backend =~ /\Apostgres/
ABresult
0X0
100
111
49 unless !ref($backend) && $backend =~ /\Apostgres/;
50  
51 79 my $relation = $section->{relation};
52 79 ▶ croak 'customer_source.relation is required: the table or view to read, schema-qualified '
Branch: 1 branch
BranchTrueFalseTotal
unless defined $relation and not ref $relation and length $relation 1 78 79
Condition66%4/6
defined $relation and not ref $relation and length $relation
!ll&&!rl&&r
1078
defined $relation and not ref $relation
!ll&&!rl&&r
1078
MC/DC33%1/3
defined $relation and not ref $relation and length $relation
defined $relation not ref $relation length $relation
Truth table50%2/4
A and not(B) and C
A= defined $relationB= not ref $relationC= length $relation
ABCresult
0XX0
10X0
1100
1111
53 . 'allowed' unless defined($relation) && !ref($relation) && length($relation);
54 78 $class->statement($relation);
55 77 my $rate_column = _true($section->{rate_column});
56  
57 77 my %conn;
58 77 ▶ if (_true($section->{from_usage_store})) {
Branch: 1 branch
BranchTrueFalseTotal
if (_true($section->{'from_usage_store'})) { } 5 72 77
59 5 my @own = grep { exists $section->{$_} } @OWN_CONNECTION;
60 5 ▶ croak 'customer_source.from_usage_store takes the usage store\'s connection; leave out '
Branch: 1 branch
BranchTrueFalseTotal
if @own 1 4 5
61 . join(', ', @own) . ' (only user and password_env may override it)' if @own;
62 4 my $usage = $opts{usage_store};
63 4 ▶ croak 'customer_source.from_usage_store needs a usage_store section with backend postgresql'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $usage eq "HASH" 1 3 4
64 unless ref($usage) eq 'HASH';
65 3 my $store = Langertha::Skeid::UsageStore->normalize_config($usage);
66 croak 'customer_source.from_usage_store needs the usage store to be postgresql, not '
67 3 ▶ . $store->{backend} unless $store->{backend} eq 'postgresql';
Branch: 1 branch
BranchTrueFalseTotal
unless $store->{"backend"} eq "postgresql" 1 2 3
68 2 %conn = (dsn => $store->{dsn}, user => $store->{user}, password => $store->{password});
69 2 ▶ $conn{user} = $section->{user} if defined $section->{user};
Branch: 1 branch
BranchTrueFalseTotal
if defined $section->{"user"} 1 1 2
70 $conn{password} = $ENV{$section->{password_env}} // ''
71 2 ▶ if defined($section->{password_env}) && length($section->{password_env});
Branch: 1 branch
BranchTrueFalseTotal
if defined $section->{"password_env"} and length $section->{"password_env"} 1 1 2
Condition60%3/5
defined $section->{"password_env"} and length $section->{"password_env"}
!ll&&!rl&&r
101
$ENV{$section->{"password_env"}} // ""
l!l
10
MC/DC50%1/2
defined $section->{"password_env"} and length $section->{"password_env"}
defined $section->{"password_env"} length $section->{"password_env"}
MC/DC0%0/1
$ENV{$section->{"password_env"}} // ""
$ENV{$section->{"password_env"}}
Truth table66%2/3
A and B
A= defined $section->{"password_env"}B= length $section->{"password_env"}
ABresult
0X0
100
111
Truth table50%1/2
A
A= $ENV{$section->{"password_env"}}
Aresult
11
00
72 } else {
73 my $store = Langertha::Skeid::UsageStore->normalize_config({
74 backend => 'postgresql',
75 72 ▶ map { exists($section->{$_}) ? ($_ => $section->{$_}) : () }
Branch: 1 branch
BranchTrueFalseTotal
exists $section->{$_} ? : 97 407 504
76 qw( dsn host port dbname database user password_env ),
77 });
78 72 %conn = (dsn => $store->{dsn}, user => $store->{user}, password => $store->{password});
79 }
80 74 ▶ croak 'customer_source.dsn must be a dbi:Pg: DSN' unless $conn{dsn} =~ /\Adbi:Pg:/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $conn{"dsn"} =~ /\Adbi:Pg:/i 1 73 74
81  
82 73 my $listen = $section->{listen};
83 73 ▶ if (defined $listen) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $listen) 9 64 73
84 9 ▶ croak 'customer_source.listen must be a channel name: letters, digits and underscores'
Branch: 1 branch
BranchTrueFalseTotal
unless not ref $listen and $listen =~ /\A$IDENT\z/ 1 8 9
Condition66%2/3
not ref $listen and $listen =~ /\A$IDENT\z/
!ll&&!rl&&r
018
MC/DC50%1/2
not ref $listen and $listen =~ /\A$IDENT\z/
not ref $listen $listen =~ /\A$IDENT\z/
Truth table66%2/3
not(A) and B
A= not ref $listenB= $listen =~ /\A$IDENT\z/
ABresult
0X0
100
111
85 unless !ref($listen) && $listen =~ /\A$IDENT\z/;
86 }
87  
88 return {
89 72 backend => 'postgresql',
90 %conn,
91 relation => "$relation",
92 refresh_interval_s => _seconds($section, 'refresh_interval_s', 30, 0),
93 listen => $listen,
94 max_stale_s => _seconds($section, 'max_stale_s', 0, 1),
95 connect_timeout_s => _seconds($section, 'connect_timeout_s', 5, 0),
96 rate_column => $rate_column,
97 };
98 }
99  
100 154 ▶sub _true {
Subroutine _true: called CC=5 SCAR=17.8
101 154 my ($value) = @_;
102 154 ▶ return 0 unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 148 6 154
103 6 ▶ return $value ? 1 : 0 if ref $value;
Branch: 2 branches
BranchTrueFalseTotal
if ref $value 0 6 6
$value ? : 0 0 0
104 6 ▶ return "$value" =~ /\A(1|true|yes|on)\z/i ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
"$value" =~ /\A(1|true|yes|on)\z/i ? : 6 0 6
105 }
106  
107 # A number of seconds; fractions allowed. $zero_ok: 0 is a value (max_stale_s), else it must be
108 # above 0.
109 205 ▶sub _seconds {
Subroutine _seconds: called CC=8 SCAR=20.8
110 205 my ($section, $key, $default, $zero_ok) = @_;
111 205 ▶ return $default unless exists $section->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $section->{$key} 108 97 205
112 97 my $value = $section->{$key};
113 97 ▶ my $ok = defined($value) && !ref($value) && $value =~ /\A[0-9]+(?:\.[0-9]+)?\z/
Branch: 1 branch
BranchTrueFalseTotal
$zero_ok ? : 5 83 88
Condition88%8/9
defined $value && !ref($value) && $value =~ /\A[0-9]+(?:\.[0-9]+)?\z/ && ($zero_ok ? $value >= 0 : $value > 0)
!ll&&!rl&&r
9286
defined $value and not ref $value and $value =~ /\A[0-9]+(?:\.[0-9]+)?\z/
!ll&&!rl&&r
2788
defined $value and not ref $value
!ll&&!rl&&r
0295
MC/DC75%3/4
defined $value && !ref($value) && $value =~ /\A[0-9]+(?:\.[0-9]+)?\z/ && ($zero_ok ? $value >= 0 : $value > 0)
defined $value not ref $value $value =~ /\A[0-9]+(?:\.[0-9]+)?\z/ ($zero_ok ? $value >= 0 : $value > 0)
Truth table80%4/5
A and not(B) and C && D
A= defined $valueB= not ref $valueC= $value =~ /\A[0-9]+(?:\.[0-9]+)?\z/D= ($zero_ok ? $value >= 0 : $value > 0)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
114 && ($zero_ok ? $value >= 0 : $value > 0);
115 97 ▶ croak "customer_source.$key must be a number of seconds " . ($zero_ok ? 'of at least 0' : 'above 0')
Branch: 2 branches
BranchTrueFalseTotal
unless $ok 11 86 97
$zero_ok ? : 1 10 11
116 unless $ok;
117 86 return 0 + $value;
118 }
119  
120  
121 92 ▶sub statement {
Subroutine statement: called CC=5 SCAR=16.5
Pod documented
122 92 my ($class, $relation, %opts) = @_;
123 92 ▶ croak 'customer_source.relation must be a table or view name, schema-qualified allowed '
Branch: 1 branch
BranchTrueFalseTotal
unless defined $relation and not ref $relation and $relation =~ /\A$IDENT(?:\.$IDENT)?\z/ 10 82 92
Condition50%3/6
defined $relation and not ref $relation and $relation =~ /\A$IDENT(?:\.$IDENT)?\z/
!ll&&!rl&&r
01082
defined $relation and not ref $relation
!ll&&!rl&&r
0092
MC/DC33%1/3
defined $relation and not ref $relation and $relation =~ /\A$IDENT(?:\.$IDENT)?\z/
defined $relation not ref $relation $relation =~ /\A$IDENT(?:\.$IDENT)?\z/
Truth table50%2/4
A and not(B) and C
A= defined $relationB= not ref $relationC= $relation =~ /\A$IDENT(?:\.$IDENT)?\z/
ABCresult
0XX0
10X0
1100
1111
124 . '(letters, digits and underscores: schema.relation)'
125 unless defined($relation) && !ref($relation) && $relation =~ /\A$IDENT(?:\.$IDENT)?\z/;
126 82 my $quoted = join '.', map { qq{"$_"} } split /\./, $relation;
127 82 ▶ return 'SELECT ' . join(', ', @COLUMNS, ($opts{rate} ? 'rate' : ())) . " FROM $quoted";
Branch: 1 branch
BranchTrueFalseTotal
$opts{'rate'} ? : 1 81 82
128 }
129  
130  
131 31 ▶sub check_rows {
Subroutine check_rows: called CC=14 SCAR=26.5
Pod documented
132 31 my ($class, $rows, %opts) = @_;
133 31 ▶ my $policies = ref($opts{policies}) eq 'HASH' ? $opts{policies} : {};
Branch: 1 branch
BranchTrueFalseTotal
ref $opts{'policies'} eq 'HASH' ? : 31 0 31
134 31 my $default = $opts{default_policy};
135 31 ▶ $rows = [] unless ref($rows) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $rows eq "ARRAY" 0 31 31
136  
137 # Duplicates are counted over every row that has a key_id string at all: a key_id shared with
138 # a row that is wrong for another reason is still not one row per key id.
139 31 my %seen;
140 31 for my $row (@$rows) {
141 67 ▶ next unless ref($row) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $row eq "HASH" 5 62 67
142 62 my $id = $row->{key_id};
143 62 ▶ $seen{$id}++ if defined($id) && !ref($id);
Branch: 1 branch
BranchTrueFalseTotal
if defined $id and not ref $id 60 2 62
Condition66%2/3
defined $id and not ref $id
!ll&&!rl&&r
0260
MC/DC50%1/2
defined $id and not ref $id
defined $id not ref $id
Truth table66%2/3
A and not(B)
A= defined $idB= not ref $id
ABresult
0X0
100
111
144 }
145  
146 31 my (@accepted, @rejected);
147 31 my $position = 0;
148 31 for my $row (@$rows) {
149 67 $position++;
150 67 my $label = _label($row, $position);
151 67 my $reason = _row_problem($row, $policies, \%seen);
152 67 my $rate;
153 67 ▶ ($rate, $reason) = _row_rate($row, $policies, $default) unless defined $reason;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $reason 44 23 67
154 67 ▶ if (defined $reason) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $reason) 25 42 67
155 25 push @rejected, { row => $label, reason => $reason };
156 25 next;
157 }
158 push @accepted, {
159 key_id => $row->{key_id},
160 name => (defined($row->{name}) && !ref($row->{name}) ? "$row->{name}" : undef),
161 policy => $row->{policy},
162 42 ▶ models => (defined($row->{models}) ? [ map { "$_" } @{$row->{models}} ] : undef),
Branch: 3 branches
BranchTrueFalseTotal
defined $row->{'name'} && !ref($row->{'name'}) ? : 20 22 42
defined $row->{'models'} ? : 3 39 42
$rate ? : 3 39 42
Condition66%2/3
defined $row->{"name"} and not ref $row->{"name"}
!ll&&!rl&&r
22020
MC/DC50%1/2
defined $row->{"name"} and not ref $row->{"name"}
defined $row->{"name"} not ref $row->{"name"}
Truth table66%2/3
A and not(B)
A= defined $row->{"name"}B= not ref $row->{"name"}
ABresult
0X0
100
111
163 ($rate ? (rate => $rate) : ()),
164 label => $label,
165 };
166 }
167 31 return { accepted => \@accepted, rejected => \@rejected };
168 }
169  
170 # What is wrong with a row, without any of its values, or undef.
171 67 ▶sub _row_problem {
Subroutine _row_problem: called CC=16 SCAR=27.8
172 67 my ($row, $policies, $seen) = @_;
173 67 ▶ return 'the row is not a row of key_id, name, policy, models' unless ref($row) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $row eq "HASH" 5 62 67
174 62 my $id = $row->{key_id};
175 62 ▶ return 'key_id is not a full key id (k_ + 40 lowercase hex digits, from `skeid keyid`)'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id and not ref $id and $id =~ /\Ak_[0-9a-f]{40}\z/ 7 55 62
Condition83%5/6
defined $id and not ref $id and $id =~ /\Ak_[0-9a-f]{40}\z/
!ll&&!rl&&r
2555
defined $id and not ref $id
!ll&&!rl&&r
0260
MC/DC66%2/3
defined $id and not ref $id and $id =~ /\Ak_[0-9a-f]{40}\z/
defined $id not ref $id $id =~ /\Ak_[0-9a-f]{40}\z/
Truth table75%3/4
A and not(B) and C
A= defined $idB= not ref $idC= $id =~ /\Ak_[0-9a-f]{40}\z/
ABCresult
0XX0
10X0
1100
1111
176 unless defined($id) && !ref($id) && $id =~ /\Ak_[0-9a-f]{40}\z/;
177 55 ▶ return 'key_id appears in more than one row' if ($seen->{$id} // 0) > 1;
Branch: 1 branch
BranchTrueFalseTotal
if ($seen->{$id} // 0) > 1 4 51 55
Condition50%1/2
$seen->{$id} // 0
l!l
550
MC/DC0%0/1
$seen->{$id} // 0
$seen->{$id}
Truth table50%1/2
A
A= $seen->{$id}
Aresult
11
00
178 51 my $policy = $row->{policy};
179 51 ▶ if (defined $policy) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $policy) 17 34 51
180 return 'policy names no profile in the file\'s policies:'
181 17 ▶ unless !ref($policy) && length($policy) && exists $policies->{$policy};
Branch: 1 branch
BranchTrueFalseTotal
unless not ref $policy and length $policy and exists $policies->{$policy} 4 13 17
Condition100%6/6
not ref $policy and length $policy and exists $policies->{$policy}
!ll&&!rl&&r
2213
not ref $policy and length $policy
!ll&&!rl&&r
1115
MC/DC100%3/3
not ref $policy and length $policy and exists $policies->{$policy}
not ref $policy length $policy exists $policies->{$policy}
Truth table100%4/4
not(A) and B and C
A= not ref $policyB= length $policyC= exists $policies->{$policy}
ABCresult
0XX0
10X0
1100
1111
182 }
183 47 my $models = $row->{models};
184 47 ▶ if (defined $models) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $models) 6 41 47
185 6 ▶ return 'models is not a list of model names' unless ref($models) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $models eq "ARRAY" 1 5 6
186 return 'models is not a list of model names'
187 5 ▶ if grep { !defined($_) || ref($_) || !length($_) } @$models;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_ or ref $_ or not length $_;} @$models 2 3 5
Condition83%5/6
!defined($_) || ref $_ || !length($_)
l!l&&r!l&&!r
112
not defined $_ or ref $_
l!l&&r!l&&!r
013
MC/DC66%2/3
!defined($_) || ref $_ || !length($_)
not defined $_ ref $_ !length($_)
Truth table75%3/4
not(A) or B || not(C)
A= not defined $_B= ref $_C= !length($_)
ABCresult
1XX1
01X1
0011
0000
188 }
189 44 return undef;
190 }
191  
192 # A row's own rate (skeid k126): (undef) without one, ($rate) within its policy's, or
193 # (undef, $reason) -- the reason names no value of the row.
194 128 my $RATE_JSON = JSON::MaybeXS->new(utf8 => 0, allow_nonref => 0);
195 44 ▶sub _row_rate {
Subroutine _row_rate: called CC=10 SCAR=23.3
196 44 my ($row, $policies, $default) = @_;
197 44 my $spec = $row->{rate};
198 44 ▶ return () unless defined $spec;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $spec 39 5 44
199 5 ▶ if (!ref $spec) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $spec) 2 3 5
200 2 $spec = eval { $RATE_JSON->decode("$spec") };
201 2 ▶ return (undef, 'rate is not a JSON object of per_s, burst, per_min') unless ref($spec) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $spec eq "HASH" 0 2 2
202 }
203 5 ▶ my $name = defined($row->{policy}) ? $row->{policy} : $default;
Branch: 1 branch
BranchTrueFalseTotal
defined $row->{'policy'} ? : 4 1 5
204 5 ▶ my $policy = (defined($name) && ref($policies->{$name}) eq 'HASH') ? $policies->{$name} : {};
Branch: 1 branch
BranchTrueFalseTotal
defined $name && ref $policies->{$name} eq 'HASH' ? : 5 0 5
Condition33%1/3
defined $name and ref $policies->{$name} eq "HASH"
!ll&&!rl&&r
005
MC/DC0%0/2
defined $name and ref $policies->{$name} eq "HASH"
defined $name ref $policies->{$name} eq "HASH"
Truth table33%1/3
A and B
A= defined $nameB= ref $policies->{$name} eq "HASH"
ABresult
0X0
100
111
205 5 my $ceiling = eval { Langertha::Skeid::Rate->normalize($policy->{rate}) };
206 5 ▶ return (undef, 'the rate of the row\'s policy is malformed') if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 5 5
207 5 my $rate = eval { Langertha::Skeid::Rate->within($spec, $ceiling) };
208 5 ▶ return (undef, 'rate is not a rate of per_s, burst, per_min') if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 1 4 5
209 4 ▶ return (undef, 'rate is looser than the rate of the row\'s policy') unless $rate;
Branch: 1 branch
BranchTrueFalseTotal
unless $rate 1 3 4
210 3 return ($rate);
211 }
212  
213 # A row's label in a report: its name, else its position. A name is a display label the owning
214 # application chose; it is printed with control characters replaced and cut to a sane length,
215 # so one row cannot forge log lines.
216 67 ▶sub _label {
Subroutine _label: called CC=6 SCAR=18.0
217 67 my ($row, $position) = @_;
218 67 ▶ my $name = ref($row) eq 'HASH' ? $row->{name} : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $row eq 'HASH' ? : 62 5 67
219 67 ▶ return "row $position" unless defined($name) && !ref($name) && length($name);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name and not ref $name and length $name 36 31 67
Condition83%5/6
defined $name and not ref $name and length $name
!ll&&!rl&&r
36031
defined $name and not ref $name
!ll&&!rl&&r
35131
MC/DC66%2/3
defined $name and not ref $name and length $name
defined $name not ref $name length $name
Truth table75%3/4
A and not(B) and C
A= defined $nameB= not ref $nameC= length $name
ABCresult
0XX0
10X0
1100
1111
220 31 (my $clean = "$name") =~ s/[^\x20-\x7e]/?/g;
221 31 ▶ $clean = substr($clean, 0, 80) . '...' if length($clean) > 80;
Branch: 1 branch
BranchTrueFalseTotal
if length $clean > 80 0 31 31
222 31 $clean =~ s/'/"/g;
223 31 return "'$clean'";
224 }
225  
226  
227 128 my $JSON = JSON::MaybeXS->new(canonical => 1, allow_nonref => 1, allow_blessed => 1, utf8 => 1);
228  
229 33 ▶sub snapshot_digest {
Subroutine snapshot_digest: called CC=4 SCAR=14.8
Pod documented
230 33 my ($class, $rows) = @_;
231 my @encoded = map {
232 56 my $row = $_;
233 56 my $text = eval { $JSON->encode($row) };
234 56 ▶ defined($text) ? $text : 'unencodable:' . (ref($row) || 'scalar');
Branch: 1 branch
BranchTrueFalseTotal
defined $text ? : 56 0 56
Condition0%0/2
ref $row || 'scalar'
l!l
00
MC/DC0%0/1
ref $row || 'scalar'
ref $row
Truth table0%0/2
A
A= ref $row
Aresult
11
00
235 33 ▶ } @{ ref($rows) eq 'ARRAY' ? $rows : [] };
Branch: 1 branch
BranchTrueFalseTotal
ref $rows eq 'ARRAY' ? : 33 0 33
236 33 return sha256_hex(join "\n", sort @encoded);
237 }
238  
239  
240 30 ▶sub merge_into {
Subroutine merge_into: called CC=21 SCAR=30.5
Pod documented
241 30 my ($class, $cfg, $rows) = @_;
242 my $checked = $class->check_rows($rows,
243 policies => (ref($cfg->{policies}) eq 'HASH' ? $cfg->{policies} : {}),
244 30 ▶ default_policy => $cfg->{default_policy});
Branch: 1 branch
BranchTrueFalseTotal
ref $cfg->{'policies'} eq 'HASH' ? : 30 0 30
245  
246 30 ▶ my %names = ref($cfg->{names}) eq 'HASH' ? %{$cfg->{names}} : ();
Branch: 1 branch
BranchTrueFalseTotal
ref $cfg->{'names'} eq 'HASH' ? : 6 24 30
247 30 my %file_ids;
248 30 ▶ if (ref($cfg->{keys}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $cfg->{"keys"} eq "HASH") 7 23 30
249 7 for my $label (keys %{$cfg->{keys}}) {
250 13 my $mapped = $names{$label};
251 13 ▶ $file_ids{ (defined($mapped) && !ref($mapped)) ? $mapped : $label } = 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $mapped && !ref($mapped) ? : 6 7 13
Condition66%2/3
defined $mapped and not ref $mapped
!ll&&!rl&&r
706
MC/DC50%1/2
defined $mapped and not ref $mapped
defined $mapped not ref $mapped
Truth table66%2/3
A and not(B)
A= defined $mappedB= not ref $mapped
ABresult
0X0
100
111
252 }
253 }
254  
255 30 my (@allow, @shadowed, %entries, %display);
256 30 for my $row (@{$checked->{accepted}}) {
257 39 my $id = $row->{key_id};
258 39 push @allow, $id;
259 # The row's display name, as its sanitized label: a report shows who a key id belongs to.
260 39 ▶ if (defined($row->{name}) && length($row->{name})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $row->{"name"} and length $row->{"name"}) 18 21 39
Condition66%2/3
defined $row->{"name"} and length $row->{"name"}
!ll&&!rl&&r
21018
MC/DC50%1/2
defined $row->{"name"} and length $row->{"name"}
defined $row->{"name"} length $row->{"name"}
Truth table66%2/3
A and B
A= defined $row->{"name"}B= length $row->{"name"}
ABresult
0X0
100
111
261 18 (my $shown = $row->{label}) =~ s/\A'(.*)'\z/$1/s;
262 18 $display{$id} = $shown;
263 }
264 39 ▶ if ($file_ids{$id} || $file_ids{substr($id, 0, 14)} || exists $names{$id}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file_ids{$id} or $file_ids{substr($id, 0, 14)} or exists $names{$id}) 3 36 39
Condition83%5/6
$file_ids{$id} or $file_ids{substr($id, 0, 14)} or exists $names{$id}
l!l&&r!l&&!r
3036
$file_ids{$id} or $file_ids{substr($id, 0, 14)}
l!l&&r!l&&!r
2136
MC/DC66%2/3
$file_ids{$id} or $file_ids{substr($id, 0, 14)} or exists $names{$id}
$file_ids{$id} $file_ids{substr($id, 0, 14)} exists $names{$id}
Truth table75%3/4
A or B or C
A= $file_ids{$id}B= $file_ids{substr($id, 0, 14)}C= exists $names{$id}
ABCresult
1XX1
01X1
0011
0000
265 3 push @shadowed, $row->{label};
266 3 next;
267 }
268 36 ▶ next unless defined($row->{policy}) || defined($row->{models}) || $row->{rate};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $row->{"policy"} or defined $row->{"models"} or $row->{"rate"} 27 9 36
Condition100%6/6
defined $row->{"policy"} or defined $row->{"models"} or $row->{"rate"}
l!l&&r!l&&!r
8127
defined $row->{"policy"} or defined $row->{"models"}
l!l&&r!l&&!r
7128
MC/DC100%3/3
defined $row->{"policy"} or defined $row->{"models"} or $row->{"rate"}
defined $row->{"policy"} defined $row->{"models"} $row->{"rate"}
Truth table100%4/4
A or B or C
A= defined $row->{"policy"}B= defined $row->{"models"}C= $row->{"rate"}
ABCresult
1XX1
01X1
0011
0000
269 $entries{$id} = {
270 (defined($row->{policy}) ? (policy => $row->{policy}) : ()),
271 (defined($row->{models}) ? (models => $row->{models}) : ()),
272 9 ▶ ($row->{rate} ? (rate => $row->{rate}) : ()),
Branch: 3 branches
BranchTrueFalseTotal
defined $row->{'policy'} ? : 7 2 9
defined $row->{'models'} ? : 1 8 9
$row->{'rate'} ? : 3 6 9
273 };
274 }
275  
276 30 my %merged = %$cfg;
277 30 ▶ $merged{keys} = { (ref($cfg->{keys}) eq 'HASH' ? %{$cfg->{keys}} : ()), %entries } if %entries;
Branch: 2 branches
BranchTrueFalseTotal
if %entries 5 25 30
ref $cfg->{'keys'} eq 'HASH' ? : 3 2 5
278 return {
279 config => \%merged,
280 allow => \@allow,
281 30 accepted => scalar(@{$checked->{accepted}}),
282 rejected => $checked->{rejected},
283 30 shadowed => \@shadowed,
284 names => \%display,
285 };
286 }
287  
288  
289 128 has config => (is => 'ro', required => 1);
290 128 has fetcher => (is => 'ro', required => 1);
291 0 ▶has on_rows => (is => 'ro', default => sub { sub { } });
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=1.2
292 0 ▶has on_failure => (is => 'ro', default => sub { sub { } });
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=1.2
293 22 ▶has notify_debounce_s => (is => 'ro', default => sub { 0.25 });
Subroutine __ANON__: called CC=1 SCAR=0.0
294  
295 22 ▶has last_success_at => (is => 'rw', default => sub { undef });
Subroutine __ANON__: called CC=1 SCAR=0.0
296 22 ▶has last_failure_at => (is => 'rw', default => sub { undef });
Subroutine __ANON__: called CC=1 SCAR=0.0
297 22 ▶has failures => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
298 22 ▶has last_error => (is => 'rw', default => sub { undef });
Subroutine __ANON__: called CC=1 SCAR=0.0
299 22 ▶has completed => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
300  
301 128 has _timer => (is => 'rw');
302 128 has _timeout => (is => 'rw');
303 128 has _debounce => (is => 'rw');
304 22 ▶has _in_flight => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
305 22 ▶has _pending => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
306 22 ▶has _serial => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
307 22 ▶has _started => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
308 22 ▶has _stopped => (is => 'rw', default => sub { 0 });
Subroutine __ANON__: called CC=1 SCAR=0.0
309  
310  
311 22 ▶sub start {
Subroutine start: called CC=3 SCAR=11.0
Pod documented
312 22 my ($self) = @_;
313 22 ▶ return $self if $self->_started;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_started 0 22 22
314 22 $self->_started(1);
315 22 my $weak = $self;
316 22 weaken($weak);
317 22 ▶ if ($self->fetcher->can('on_notify')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->fetcher->can("on_notify")) 12 10 22
318 12 ▶ $self->fetcher->on_notify(sub { $weak->_notified if $weak });
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
if $weak 21 0 21
319 }
320 22 $self->_schedule(0);
321 22 return $self;
322 }
323  
324  
325 44 ▶sub stop {
Subroutine stop: called CC=4 SCAR=13.9
Pod documented
326 44 my ($self) = @_;
327 44 ▶ return if $self->_stopped;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_stopped 22 22 44
328 22 $self->_stopped(1);
329 22 $self->_in_flight(0);
330 22 for my $timer (qw(_timer _timeout _debounce)) {
331 66 my $id = $self->$timer;
332 66 ▶ Mojo::IOLoop->remove($id) if defined $id;
Branch: 1 branch
BranchTrueFalseTotal
if defined $id 21 45 66
333 66 $self->$timer(undef);
334 }
335 22 $self->release;
336 22 return;
337 }
338  
339  
340 23 ▶sub release {
Subroutine release: called CC=2 SCAR=6.9
Pod documented
341 23 my ($self) = @_;
342 23 my $fetcher = $self->fetcher;
343 23 ▶ eval { $fetcher->release; 1 } if $fetcher->can('release');
Branch: 1 branch
BranchTrueFalseTotal
if $fetcher->can("release") 13 10 23
344 23 return;
345 }
346  
347  
348 50 ▶sub fetch_now {
Subroutine fetch_now: called CC=6 SCAR=18.6
Pod documented
349 50 my ($self) = @_;
350 50 ▶ return if $self->_stopped;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_stopped 0 50 50
351 50 ▶ if ($self->_in_flight) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_in_flight) 0 50 50
352 0 $self->_pending(1);
353 0 return;
354 }
355 50 my $timer = $self->_timer;
356 50 ▶ Mojo::IOLoop->remove($timer) if defined $timer;
Branch: 1 branch
BranchTrueFalseTotal
if defined $timer 9 41 50
357 50 $self->_timer(undef);
358  
359 50 $self->_in_flight(1);
360 50 my $serial = $self->_serial + 1;
361 50 $self->_serial($serial);
362 50 my $weak = $self;
363 50 weaken($weak);
364 50 my $limit = $self->config->{connect_timeout_s};
365 2 ▶ $self->_timeout(Mojo::IOLoop->timer($limit => sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
366 2 ▶ $weak->_done($serial, "fetch timed out after ${limit}s") if $weak;
Branch: 1 branch
BranchTrueFalseTotal
if $weak 2 0 2
367 50 }));
368 50 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->fetcher->fetch(sub { my($err, $rows) = @_; $weak->_done($serial, $err, $rows) if $weak; } ); 1 } } or $self->_done($serial, $@ || "fetch failed") 50 0 50
369 46 ▶ $self->fetcher->fetch(sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
370 46 my ($err, $rows) = @_;
371 46 ▶ $weak->_done($serial, $err, $rows) if $weak;
Branch: 1 branch
BranchTrueFalseTotal
if $weak 45 1 46
372 50 });
373 50 ▶ 1;
Condition0%0/2
$@ || 'fetch failed'
l!l
00
MC/DC0%0/1
$@ || 'fetch failed'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
374 } or $self->_done($serial, $@ || 'fetch failed');
375 50 return;
376 }
377  
378 47 ▶sub _done {
Subroutine _done: called CC=15 SCAR=28.0
379 47 my ($self, $serial, $err, $rows) = @_;
380 # A late answer -- after its timeout, or after a stop -- belongs to nobody any more.
381 47 ▶ return unless $self->_in_flight && $serial == $self->_serial && !$self->_stopped;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_in_flight and $serial == $self->_serial and not $self->_stopped 1 46 47
Condition66%4/6
$self->_in_flight and $serial == $self->_serial and not $self->_stopped
!ll&&!rl&&r
1046
$self->_in_flight and $serial == $self->_serial
!ll&&!rl&&r
1046
MC/DC33%1/3
$self->_in_flight and $serial == $self->_serial and not $self->_stopped
$self->_in_flight $serial == $self->_serial not $self->_stopped
Truth table50%2/4
A and B and not(C)
A= $self->_in_flightB= $serial == $self->_serialC= not $self->_stopped
ABCresult
0XX0
10X0
1100
1111
382 46 $self->_in_flight(0);
383 46 my $timeout = $self->_timeout;
384 46 ▶ Mojo::IOLoop->remove($timeout) if defined $timeout;
Branch: 1 branch
BranchTrueFalseTotal
if defined $timeout 46 0 46
385 46 $self->_timeout(undef);
386 46 $self->completed($self->completed + 1);
387  
388 46 ▶ $err = 'the fetch answered no row list' if !defined($err) && ref($rows) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $err and ref $rows ne "ARRAY" 0 46 46
Condition66%2/3
not defined $err and ref $rows ne "ARRAY"
!ll&&!rl&&r
13330
MC/DC0%0/2
not defined $err and ref $rows ne "ARRAY"
not defined $err ref $rows ne "ARRAY"
Truth table66%2/3
not(A) and B
A= not defined $errB= ref $rows ne "ARRAY"
ABresult
0X0
100
111
389 46 ▶ if (defined $err) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $err) { } 13 33 46
390 13 $err = _clean_error($err);
391 13 my $previous = $self->last_error;
392 13 $self->failures($self->failures + 1);
393 13 $self->last_failure_at(Time::HiRes::time());
394 13 $self->last_error($err);
395 13 ▶ warn "skeid: customer_source fetch failed, keeping the last good snapshot: $err\n"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $previous or $previous ne $err 7 6 13
Condition100%3/3
not defined $previous or $previous ne $err
l!l&&r!l&&!r
616
MC/DC100%2/2
not defined $previous or $previous ne $err
not defined $previous $previous ne $err
Truth table100%3/3
not(A) or B
A= not defined $previousB= $previous ne $err
ABresult
1X1
011
000
396 if !defined($previous) || $previous ne $err;
397 13 ▶ eval { $self->on_failure->($err); 1 } or warn "skeid: customer_source: $@";
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->on_failure->($err); 1 } } or warn "skeid: customer_source: $@" 13 0 13
398 13 $self->_schedule($self->retry_delay);
399 } else {
400 33 ▶ warn "skeid: customer_source fetch succeeded again\n" if $self->failures;
Branch: 1 branch
BranchTrueFalseTotal
if $self->failures 3 30 33
401 33 $self->failures(0);
402 33 $self->last_error(undef);
403 33 $self->last_success_at(Time::HiRes::time());
404 33 ▶ eval { $self->on_rows->($rows); 1 } or warn "skeid: customer_source: $@";
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->on_rows->($rows); 1 } } or warn "skeid: customer_source: $@" 33 0 33
405 33 $self->_schedule($self->config->{refresh_interval_s});
406 }
407  
408 46 ▶ if ($self->_pending && !$self->_stopped) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_pending and not $self->_stopped) 0 46 46
Condition33%1/3
$self->_pending and not $self->_stopped
!ll&&!rl&&r
4600
MC/DC0%0/2
$self->_pending and not $self->_stopped
$self->_pending not $self->_stopped
Truth table33%1/3
A and not(B)
A= $self->_pendingB= not $self->_stopped
ABresult
0X0
100
111
409 0 $self->_pending(0);
410 0 $self->_schedule(0);
411 }
412 46 return;
413 }
414  
415  
416 13 ▶sub retry_delay {
Subroutine retry_delay: called CC=3 SCAR=11.4
Pod documented
417 13 my ($self) = @_;
418 13 ▶ my $failures = $self->failures || 1;
Condition50%1/2
$self->failures || 1
l!l
130
MC/DC0%0/1
$self->failures || 1
$self->failures
Truth table50%1/2
A
A= $self->failures
Aresult
11
00
419 13 my $delay = $self->config->{refresh_interval_s} * 2 ** ($failures - 1);
420 13 ▶ return $delay > $BACKOFF_MAX ? $BACKOFF_MAX : $delay;
Branch: 1 branch
BranchTrueFalseTotal
$delay > $BACKOFF_MAX ? : 0 13 13
421 }
422  
423 68 ▶sub _schedule {
Subroutine _schedule: called CC=3 SCAR=11.0
424 68 my ($self, $delay) = @_;
425 68 ▶ return if $self->_stopped;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_stopped 1 67 68
426 67 my $timer = $self->_timer;
427 67 ▶ Mojo::IOLoop->remove($timer) if defined $timer;
Branch: 1 branch
BranchTrueFalseTotal
if defined $timer 0 67 67
428 67 my $weak = $self;
429 67 weaken($weak);
430 41 ▶ $self->_timer(Mojo::IOLoop->timer($delay => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
431 41 ▶ return unless $weak;
Branch: 1 branch
BranchTrueFalseTotal
unless $weak 0 41 41
432 41 $weak->_timer(undef);
433 41 $weak->fetch_now;
434 67 }));
435 67 return;
436 }
437  
438 # A notification: one fetch after the debounce, however many more arrive before it runs.
439 21 ▶sub _notified {
Subroutine _notified: called CC=3 SCAR=11.0
440 21 my ($self) = @_;
441 21 ▶ return if $self->_stopped || defined $self->_debounce;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_stopped or defined $self->_debounce 19 2 21
Condition66%2/3
$self->_stopped or defined $self->_debounce
l!l&&r!l&&!r
0192
MC/DC50%1/2
$self->_stopped or defined $self->_debounce
$self->_stopped defined $self->_debounce
Truth table66%2/3
A or B
A= $self->_stoppedB= defined $self->_debounce
ABresult
1X1
011
000
442 2 my $weak = $self;
443 2 weaken($weak);
444 2 ▶ $self->_debounce(Mojo::IOLoop->timer($self->notify_debounce_s => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
445 2 ▶ return unless $weak;
Branch: 1 branch
BranchTrueFalseTotal
unless $weak 0 2 2
446 2 $weak->_debounce(undef);
447 2 $weak->fetch_now;
448 2 }));
449 2 return;
450 }
451  
452 # A driver error names the DSN it failed on, and a DSN may carry a password.
453 13 ▶sub _clean_error {
Subroutine _clean_error: called CC=2 SCAR=7.0
454 13 my ($err) = @_;
455 13 $err = "$err";
456 13 $err =~ s/\b(password|pwd)=[^;'"\s)]*/$1=***/gi;
457 13 $err =~ s/\s+\z//;
458 13 ▶ return length($err) ? $err : 'fetch failed';
Branch: 1 branch
BranchTrueFalseTotal
length $err ? : 13 0 13
459 }
460  
461  
462 231 ▶sub status {
Subroutine status: called CC=6 SCAR=17.9
Pod documented
463 231 my ($self) = @_;
464 231 ▶ my $iso = sub { defined($_[0]) ? strftime('%Y-%m-%dT%H:%M:%SZ', gmtime(int $_[0])) : undef };
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 236 3 239
465 231 ▶ my $ok = defined($self->last_success_at) && !$self->failures ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->last_success_at && !$self->failures ? : 222 9 231
Condition100%3/3
defined $self->last_success_at and not $self->failures
!ll&&!rl&&r
36222
MC/DC100%2/2
defined $self->last_success_at and not $self->failures
defined $self->last_success_at not $self->failures
Truth table100%3/3
A and not(B)
A= defined $self->last_success_atB= not $self->failures
ABresult
0X0
100
111
466 return {
467 231 ▶ ok => $ok,
Branch: 2 branches
BranchTrueFalseTotal
$self->failures ? : 8 223 231
$ok ? : 222 9 231
Condition100%2/2
$self->last_error // "no fetch has finished yet"
l!l
81
MC/DC100%1/1
$self->last_error // "no fetch has finished yet"
$self->last_error
Truth table100%2/2
A
A= $self->last_error
Aresult
11
00
468 last_success_at => $iso->($self->last_success_at),
469 failed_at => ($self->failures ? $iso->($self->last_failure_at) : undef),
470 failures => 0 + $self->failures,
471 error => ($ok ? undef : ($self->last_error // 'no fetch has finished yet')),
472 };
473 }
474  
475 22 ▶sub DEMOLISH {
Subroutine DEMOLISH: called CC=2 SCAR=7.1
Pod undocumented
476 22 my ($self, $global) = @_;
477 22 ▶ return if $global;
Branch: 1 branch
BranchTrueFalseTotal
if $global 0 22 22
478 22 $self->stop;
479 }
480  
481  
482 128 1;
483  
484 __END__
« lib/Langertha/Skeid/Protocol/Documents.pm ↑ Summary lib/Langertha/Skeid/Protocol/Realtime.pm »