App-MtAws

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
        `mtime-and-treehash`  is mnemonic for  *File is modified if mtime differs AND treehash differs*. Words
        *AND* and *OR* means here logical operators with [short-circuit evaluation](http://en.wikipedia.org/wiki/Short-circuit_evaluation)
        i.e. with `mtime-and-treehash` treehash never checked if mtime not differs. And with `mtime-or-treehash` treehash never checked if mtime differs.
 
NOTE: files with zero sizes are not supported by Amazon Glacier API, thus considered non-existing for consistency, for all `sync` modes.
 
NOTE: `sync` does not upload empty directories, there is no such thing as directory in Amazon Glacier.
 
NOTE: With `--dry-run` option TreeHash will not be calculated, instead *Will VERIFY treehash and upload...* message will be displayed.
 
NOTE: TreeHash calculation performed in parallel, so some of workers (defined with `--concurrency`) might be busy calculating treehash instead
of network IO.
 
### `restore`
 
Initiate Amazon Glacier RETRIEVE oparation for files listed in Journal, which don't *exist* on local filesystem and for
which RETRIEVE was not initiated during last 24 hours (that information obtained from *Journal* too - each retrieval logged
into journal together with timestamp)
 
### `restore-completed`

lib/App/MtAws/QueueEngine.pm  view on Meta::CPAN

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
                                return $job
                        } else {
                                confess;
                        }
                } else {
                        $self->wait_worker();
                }
        }
}
 
sub get_busy_workers_ids
{
        my ($self) = @_;
        grep { $self->{workers}{$_}{task} } keys %{ $self->{workers}};
}
 
1;

t/lib/MyQueueEngine.pm  view on Meta::CPAN

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
        my ($self, %args) = @_;
        $self->add_worker($_) for (1..$args{n});
}
 
sub queue { }
 
sub wait_worker
{
        my ($self) = @_;
        my @possible = $self->get_busy_workers_ids;
        confess unless @possible;
        my $worker_id = $possible[lcg_irand(0, @possible-1)];
 
        my $task = $self->unqueue_task($worker_id);
 
        my $method = "on_$task->{action}";
        no strict 'refs';
 
        my @r = $self->$method(%{$task->{args}});
        $task->{cb_task_proxy}->(@r);



( run in 0.525 second using v1.01-cache-2.11-cpan-5f2e87ce722 )