Optimization: First broke out all the classes that were in Engine.pm so that I can...
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Iterator / Index.pm
1 package DBM::Deep::Iterator::Index;
2
3 use 5.006;
4
5 use strict;
6 use warnings FATAL => 'all';
7
8 sub new {
9     my $self = bless $_[1] => $_[0];
10     $self->{curr_index} = 0;
11     return $self;
12 }
13
14 sub at_end {
15     my $self = shift;
16     return $self->{curr_index} >= $self->{iterator}{engine}->hash_chars;
17 }
18
19 sub get_next_iterator {
20     my $self = shift;
21
22     my $loc;
23     while ( !$loc ) {
24         return if $self->at_end;
25         $loc = $self->{sector}->get_entry( $self->{curr_index}++ );
26     }
27
28     return $self->{iterator}->get_sector_iterator( $loc );
29 }
30
31 1;
32 __END__