The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Zing::Poll - Blocking Receive

ABSTRACT

Blocking Receive Construct

SYNOPSIS

  use Zing::Poll;
  use Zing::KeyVal;

  my $poll = Zing::Poll->new(repo => Zing::KeyVal->new(name => 'notes'));

  # $poll->await(0);

DESCRIPTION

This package provides an algorithm for preforming a blocking receive by polling the datastore for a specific item.

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

repo

  repo(Repo)

This attribute is read-only, accepts (Repo) values, and is required.

METHODS

This package implements the following methods:

await

  await(Int $secs) : Maybe[HashRef]

The await method polls the datastore specified for the data at the key specified, for at-least the number of seconds specified, and returns the data or undefined.

await example #1
  # given: synopsis

  $poll->await(0);
await example #2
  # given: synopsis

  $poll->repo->send({ task => 'write research paper' });

  $poll->await(0);

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues