1 package DBM::Deep::Engine;
6 use warnings FATAL => 'all';
8 use DBM::Deep::Iterator ();
11 # * Every method in here assumes that the storage has been appropriately
12 # safeguarded. This can be anything from flock() to some sort of manual
13 # mutex. But, it's the caller's responsability to make sure that this has
16 # Setup file and tag signatures. These should never change.
17 sub SIG_FILE () { 'DPDB' }
18 sub SIG_HEADER () { 'h' }
19 sub SIG_HASH () { 'H' }
20 sub SIG_ARRAY () { 'A' }
21 sub SIG_NULL () { 'N' }
22 sub SIG_DATA () { 'D' }
23 sub SIG_INDEX () { 'I' }
24 sub SIG_BLIST () { 'B' }
25 sub SIG_FREE () { 'F' }
28 =head2 get_next_key( $obj, $prev_key )
30 This takes an object that provides _base_offset() and an optional string
31 representing the prior key returned via a prior invocation of this method.
33 This method delegates to C<< DBM::Deep::Iterator->get_next_key() >>.
37 # XXX Add staleness here
40 my ($obj, $prev_key) = @_;
42 # XXX Need to add logic about resetting the iterator if any key in the reference has changed
43 unless ( $prev_key ) {
44 $obj->{iterator} = DBM::Deep::Iterator->new({
45 base_offset => $obj->_base_offset,
50 return $obj->{iterator}->get_next_key( $obj );