line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flux::Log::In; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Flux::Log::In::VERSION = '1.00'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: input stream for Flux::Log storage. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
with |
11
|
|
|
|
|
|
|
'Flux::In::Role::Easy', |
12
|
|
|
|
|
|
|
'Flux::In::Role::Lag', |
13
|
|
|
|
|
|
|
'Flux::Role::Description'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
328
|
use Type::Params qw(validate); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
16
|
1
|
|
|
1
|
|
186
|
use Types::Standard qw( Int Str HashRef Object Optional ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
1342
|
use Log::Unrotate; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has '_unrotate_params' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => HashRef, |
23
|
|
|
|
|
|
|
init_arg => 'unrotate', |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has 'log' => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
isa => Str, |
30
|
|
|
|
|
|
|
required => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has '_unrotate' => ( |
34
|
|
|
|
|
|
|
is => 'lazy', |
35
|
|
|
|
|
|
|
isa => Object, |
36
|
|
|
|
|
|
|
default => sub { |
37
|
|
|
|
|
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
return Log::Unrotate->new({ |
39
|
|
|
|
|
|
|
log => $self->log, |
40
|
|
|
|
|
|
|
%{ $self->_unrotate_params } |
41
|
|
|
|
|
|
|
}); |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub description { |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $current_log = $self->_unrotate->_log_file; # FIXME - incapsulation violation! |
49
|
|
|
|
|
|
|
return |
50
|
|
|
|
|
|
|
"pos: ".$self->_unrotate_params->{pos}."\n" |
51
|
|
|
|
|
|
|
."log: $current_log"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub clone { |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
return __PACKAGE__->new({ unrotate => $self->_unrotate_params }); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub read { |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
validate(\@_); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $self->_unrotate->read; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub position { |
67
|
|
|
|
|
|
|
my $self = shift; |
68
|
|
|
|
|
|
|
validate(\@_); |
69
|
|
|
|
|
|
|
return $self->_unrotate->position; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub lag { |
73
|
|
|
|
|
|
|
my $self = shift; |
74
|
|
|
|
|
|
|
validate(\@_); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
return $self->_unrotate->lag; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub commit { |
80
|
|
|
|
|
|
|
my $self = shift; |
81
|
|
|
|
|
|
|
my ($position) = validate(\@_, Optional[Int]); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$self->_unrotate->commit($position ? $position : ()); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |