| 1 | use utf8; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | package DR::Tnt::Client::Coro; | ||
| 6 | use Carp; | ||
| 7 | $Carp::Internal{ (__PACKAGE__) }++; | ||
| 8 | use Coro; | ||
| 9 | use Mouse; | ||
| 10 | |||
| 11 | sub driver { 'async' } | ||
| 12 | |||
| 13 | sub request { | ||
| 14 | my ($self, @args) = @_; | ||
| 15 | |||
| 16 | my $cb = Coro::rouse_cb; | ||
| 17 | |||
| 18 | my $m = $args[0]; | ||
| 19 | |||
| 20 | @args = ('select', @args[1, 2, 3], 1, 0, 'EQ') if $m eq 'get'; | ||
| 21 | |||
| 22 | $self->_fcb->request(@args, $cb); | ||
| 23 | my ($status, $message, $resp) = Coro::rouse_wait $cb; | ||
| 24 | |||
| 25 | return $self->_response($m, $status, $message, $resp); | ||
| 26 | } | ||
| 27 | |||
| 28 | with 'DR::Tnt::Client::Role::LikeSync'; | ||
| 29 | |||
| 30 | __PACKAGE__->meta->make_immutable; |