Cleanup: Mojo-ize old code, simplifying perl OO code
Make Sql Storage inherit Filesystem, since the DB is only used as an index and still stores on disk
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package CrashTest::Decode::Queue::Gearman;
use Mojo::Base -base;
use Gearman::Client;
has [ qw/config gearman/ ];
sub new {
my $self = shift->SUPER::new(@_);
$self->gearman(Gearman::Client->new(
job_servers => $self->config->{GearmanServers})
);
return $self;
}
sub decode {
my ($self, $file, $paramshash, $uuidstr, $cb) = @_;
my $json = Mojo::JSON->new;
my $args = $json->encode(
{
file => $file->slurp,
params => $paramshash,
uuid => $uuidstr
}
);
$self->gearman->dispatch_background('dump_decode', $args);
$cb->({ status => "backgrounded" });
}
1;