line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flux::Storage::Memory::In; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Flux::Storage::Memory::In::VERSION = '1.03'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: in-memory input stream for Flux::MemoryStorage |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
10
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
with |
10
|
|
|
|
|
|
|
'Flux::In::Role::Easy', |
11
|
|
|
|
|
|
|
'Flux::In::Role::Lag'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'storage' => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'client' => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
required => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has 'pos' => ( |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
lazy => 1, |
26
|
|
|
|
|
|
|
default => sub { |
27
|
|
|
|
|
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
return $self->storage->_get_client_pos($self->client); |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub read { |
33
|
16
|
|
|
16
|
0
|
164
|
my $self = shift; |
34
|
16
|
|
|
|
|
733
|
my $item = $self->storage->_read($self->pos); |
35
|
16
|
100
|
|
|
|
60
|
return unless $item; |
36
|
12
|
|
|
|
|
546
|
$self->pos($self->pos + 1); |
37
|
12
|
|
|
|
|
140
|
return $item; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub commit { |
41
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
42
|
2
|
|
|
|
|
58
|
$self->storage->_set_client_pos($self->client, $self->pos); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub lag { |
46
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
47
|
3
|
|
|
|
|
80
|
return $self->storage->_lag($self->pos); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub DEMOLISH { |
51
|
8
|
|
|
8
|
0
|
14042
|
local $@; |
52
|
8
|
|
|
|
|
13
|
my $self = shift; |
53
|
8
|
|
|
|
|
54
|
$self->storage->_unlock_client($self->client); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |