package Tak::Remote;

use Moo;

has router => (is => 'ro', required => 1);

has name => (is => 'ro', required => 1);

sub blocking_request {
  my ($self, @payload) = @_;
  my ($done, @result);
  my $cb = sub { my ($self, $tag, @r) = @_; @result = @r; $done = 1; };
  $self->router->send_request($self, $cb, $self->name, @payload);
  $self->router->run_until($done);
  return @result;
}

1;
