« LongSteps/Storage/AutoDBIx/Schema/Result/LongstepProcess.pm
↑ Summary
LongSteps/Storage/AutoDBIx.pm »
| 1 | package Schedule::LongSteps::Storage; | ||
| 2 | 16 | $Schedule::LongSteps::Storage::VERSION = '0.023'; | |
| 3 | 16 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Schedule::LongSteps::Storage - An abstract storage class for steps | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | 16 | ▶ | use Data::UUID; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 16 | has 'uuid' => ( is => 'ro', isa => 'Data::UUID', lazy_build => 1); | |
| 14 | |||
| 15 | 13 | ▶ | sub _build_uuid{ |
|
Subroutine
_build_uuid: called CC=1 SCAR=0.0
| |||
| 16 | 13 | my ($self) = @_; | |
| 17 | 13 | return Data::UUID->new(); | |
| 18 | } | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | =head2 prepare_due_processes | ||
| 23 | |||
| 24 | Mark the processes that are due to run as 'running' and | ||
| 25 | returns an array of stored processes. | ||
| 26 | |||
| 27 | Users: Note that this is meant to be used by L<Schedule::LongSteps>, and not intended | ||
| 28 | to be called directly. | ||
| 29 | |||
| 30 | Implementors: You will have to implement this method should you wish to implement | ||
| 31 | a new process storage backend. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | 0 | ▶ | sub prepare_due_processes{ |
|
Subroutine
prepare_due_processes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | 0 | my ($self) = @_; | |
| 37 | 0 | die "Please implement this in $self"; | |
| 38 | } | ||
| 39 | |||
| 40 | =head2 create_process | ||
| 41 | |||
| 42 | Creates and return a new stored process. | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | 0 | ▶ | sub create_process{ |
|
Subroutine
create_process: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 47 | 0 | my ($self, $properties) = @_; | |
| 48 | 0 | die "Please implement this in $self"; | |
| 49 | } | ||
| 50 | |||
| 51 | =head2 find_process | ||
| 52 | |||
| 53 | Returns a stored process based on the given ID, or undef if no such thing exists. | ||
| 54 | |||
| 55 | Usage: | ||
| 56 | |||
| 57 | my $stored_process = $this->find_process( $pid ); | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | 0 | ▶ | sub find_process{ |
|
Subroutine
find_process: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 62 | 0 | my ($self, $pid) = @_; | |
| 63 | 0 | die "Please implement this in $self"; | |
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | =head2 update_process | ||
| 68 | |||
| 69 | Updates the given stored process (as returned by 'find_process') | ||
| 70 | with the given properties. | ||
| 71 | |||
| 72 | Usage: | ||
| 73 | |||
| 74 | $this->update_process( $process , { run_at => DateTime->now(), .. } ); | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | 36 | ▶ | sub update_process{ |
|
Subroutine
update_process: called CC=1 SCAR=0.0
Pod
documented
| |||
| 79 | 36 | my ($self, $process, $properties) = @_; | |
| 80 | 36 | $process->update( $properties ); | |
| 81 | } | ||
| 82 | |||
| 83 | 16 | __PACKAGE__->meta()->make_immutable(); | |