Convert ::Reference to use a string in creation. This sparks an interesting debate...
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Iterator / BucketList.pm
CommitLineData
065b45be 1package DBM::Deep::Iterator::BucketList;
2
9c7d9738 3use 5.006_000;
065b45be 4
5use strict;
6use warnings FATAL => 'all';
7
8sub new {
9 my $self = bless $_[1] => $_[0];
10 $self->{curr_index} = 0;
11 return $self;
12}
13
14sub at_end {
15 my $self = shift;
16 return $self->{curr_index} >= $self->{iterator}{engine}->max_buckets;
17}
18
19sub get_next_key {
20 my $self = shift;
21
22 return if $self->at_end;
23
24 my $idx = $self->{curr_index}++;
25
26 my $data_loc = $self->{sector}->get_data_location_for({
27 allow_head => 1,
28 idx => $idx,
29 }) or return;
30
31 #XXX Do we want to add corruption checks here?
32 return $self->{sector}->get_key_for( $idx )->data;
33}
34
351;
36__END__