line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RecordStream::Clumper::KeyLRU; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
110
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
103
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
20
|
use App::RecordStream::Clumper::Key; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
359
|
|
7
|
4
|
|
|
4
|
|
24
|
use App::RecordStream::DomainLanguage::Registry; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
106
|
|
8
|
4
|
|
|
4
|
|
1190
|
use App::RecordStream::LRUSheriff; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
114
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
27
|
use base 'App::RecordStream::Clumper::Key'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1610
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
5
|
|
|
5
|
0
|
10
|
my $class = shift; |
15
|
5
|
|
|
|
|
13
|
my $field = shift; |
16
|
5
|
|
|
|
|
8
|
my $size = shift; |
17
|
|
|
|
|
|
|
|
18
|
5
|
|
|
|
|
31
|
my $this = $class->SUPER::new($field); |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
19
|
$this->{'size'} = $size; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
33
|
return $this; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new_from_valuation |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
28
|
0
|
|
|
|
|
0
|
my $name = shift; |
29
|
0
|
|
|
|
|
0
|
my $valuation = shift; |
30
|
0
|
|
|
|
|
0
|
my $size = shift; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
my $this = $class->SUPER::new_from_valuation($name, $valuation); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
$this->{'size'} = $size; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
return $this; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub long_usage |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
0
|
0
|
return <
|
42
|
|
|
|
|
|
|
Usage: keylru,, |
43
|
|
|
|
|
|
|
Clump records by the value for a key, limiting number of active clumps to |
44
|
|
|
|
|
|
|
EOF |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub short_usage |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
0
|
0
|
0
|
return "clump records by the value for a key, limiting number of active clumps"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub argct |
53
|
|
|
|
|
|
|
{ |
54
|
5
|
|
|
5
|
0
|
14
|
return 2; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub key_clumper_begin |
58
|
|
|
|
|
|
|
{ |
59
|
11
|
|
|
11
|
0
|
48
|
return App::RecordStream::LRUSheriff->new(); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub key_clumper_push_record |
63
|
|
|
|
|
|
|
{ |
64
|
62
|
|
|
62
|
0
|
125
|
my $this = shift; |
65
|
62
|
|
|
|
|
110
|
my $cookie = shift; |
66
|
62
|
|
|
|
|
114
|
my $value = shift; |
67
|
62
|
|
|
|
|
105
|
my $record = shift; |
68
|
62
|
|
|
|
|
108
|
my $next = shift; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
{ |
71
|
62
|
|
|
|
|
105
|
my $next_cookie = $cookie->find($value); |
|
62
|
|
|
|
|
210
|
|
72
|
62
|
100
|
|
|
|
173
|
if(!defined($next_cookie)) |
73
|
|
|
|
|
|
|
{ |
74
|
34
|
|
|
|
|
102
|
$cookie->put($value, $next_cookie = $next->key_clumper_callback_begin()); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
62
|
|
|
|
|
219
|
$next->key_clumper_callback_push_record($next_cookie, $record); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
62
|
|
|
|
|
230
|
for my $next_cookie ($cookie->purgenate($this->{'size'})) |
81
|
|
|
|
|
|
|
{ |
82
|
13
|
|
|
|
|
49
|
$next->key_clumper_callback_end($next_cookie); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub key_clumper_end |
87
|
|
|
|
|
|
|
{ |
88
|
11
|
|
|
11
|
0
|
25
|
my $this = shift; |
89
|
11
|
|
|
|
|
20
|
my $cookie = shift; |
90
|
11
|
|
|
|
|
21
|
my $next = shift; |
91
|
|
|
|
|
|
|
|
92
|
11
|
|
|
|
|
35
|
for my $next_cookie ($cookie->purgenate(0)) |
93
|
|
|
|
|
|
|
{ |
94
|
21
|
|
|
|
|
82
|
$next->key_clumper_callback_end($next_cookie); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
App::RecordStream::Clumper->register_implementation('keylru', __PACKAGE__); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'keylru', 'SCALAR', 'VALUATION', 'SCALAR'); |
101
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'key', 'SCALAR', 'VALUATION', 'SCALAR'); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |