Adapter-Async
view release on metacpan or search on metacpan
lib/Adapter/Async/OrderedList.pod view on Meta::CPAN
=for comment POD_DERIVED_INDEX_GENERATED
The following documentation is automatically generated. Please do not edit
this file, but rather the original, inline with Adapter::Async::OrderedList
at lib/Adapter/Async/OrderedList.pm
(on the system that originally ran this).
If you do edit this file, and don't want your changes to be removed, make
sure you change the first line.
=cut
=head1 NAME
Adapter::Async::OrderedList - API for dealing with ordered lists
=head1 VERSION
version 0.018
=head1 DESCRIPTION
=head2 Accessing data
=over 4
=item * count - resolves with the number of items. If this isn't possible, an estimate may be acceptable.
say "items: " . $adapter->count->get
=item * get - accepts a list of indices
$adapter->get(
items => [1,2,3],
on_item => sub { ... }
)->on_done(sub { warn "all done, full list of items: @{$_[0]}" })
The returned list of items are guaranteed not to be modified further, if you want to store the arrayref directly.
=back
This means we have double-notify on get: a request for (1,2,3,4) needs to fire events for each of 1,2,3,4, and also return the list of all of them on completion (by resolving a Future).
=head2 Modification
=over 4
=item * clear - remove all data
=item * splice - modify by adding/removing items at a given point
=item * modify - changes a single entry
=back
Helper methods provide the following:
=over 4
=item * insert - splice $idx, @data, 0
=item * append - splice $idx + 1, @data, 0
=back
=head2 Events
All events are shared over a common bus for each data source, in the usual fashion - adapters and views can subscribe to the ones they're interested in, and publish events at any time.
( run in 1.020 second using v1.01-cache-2.11-cpan-39bf76dae61 )