package CloudStore::Gearman;
use warnings;
use strict;

use Gearman::XS qw(:constants);
use Gearman::XS::Client;

use Gearman::Client;
use Data::Dump qw(dump);

sub gearman {
	my $gearman = Gearman::XS::Client->new;
	$gearman->add_server('127.0.0.1' => 4730);
	return $gearman;
}

sub gearman_do {
	my $self = shift @_;
	my $func = shift @_;
	my $body = join(' ', @_) . "\n";
	warn "## gearman_do $func [$body]\n";

	my ($ret,$result) = $self->gearman->do( $func => $body );
	warn "##>> ",dump($ret, $result),$/;
	return $result;
}

1;
