ElasticSearchX::Sequence::Iterator - Fast integer ID sequences with ElasticSearch
my $it = $seq->sequence('mail_id'); say $it->next; # 1 $mail_id->set(1000); say $it->next # 1000
my $it = ElasticSearchX::Sequence::Iterator->new( sequence => $seq, # ElasticSearchX::Sequence instance, required name => 'mail_id', # name of iterator, required size => 100, # number of IDs to reserve at a time, default 100 );
new() returns a new instance of ElasticSearchX::Sequence::Iterator.
Normally, you would never need to call this method directly, but instead you would use "sequence()" in ElasticSearchX::Sequence.
IDs are reserved in blocks of
size (default 100).
$id = $it->next;
Returns the next ID in the sequence.
$id = $it->release($id);
$id to allow it to be reused.
NOTE: You must be certain that the ID hasn't already been used by your application. Also, there is no guarantee that your released ID will be reused. It is "released" only to the current iterator - this is not application wide.
This can be used to set a new HIGHER ID for this iterator. You cannot reset the iterator to a lower number without deleting the index.
$name = $it->name()
Read-only getter for the iterator name.
$seq = $it->sequence();
Read-only getter for the associated ElasticSearchX::Sequence instance.
Clinton Gormley <email@example.com>
This software is copyright (c) 2011 by Clinton Gormley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.