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