From: rkinyon Date: Mon, 19 Jun 2006 13:12:08 +0000 (+0000) Subject: r14010@Rob-Kinyons-PowerBook: rob | 2006-06-07 14:35:06 -0400 X-Git-Tag: 0-99_03~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b62364d2f200e91e4317cacc31ee47072772904;p=dbsrgits%2FDBM-Deep.git r14010@Rob-Kinyons-PowerBook: rob | 2006-06-07 14:35:06 -0400 Converted to use _storage instead of _fileobj and laid out the new code for using key-to-me pointers --- diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index d6ba021..7414fae 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -64,6 +64,39 @@ sub key_exists { return $self->bucket_exists( $tag, $dig_key, $key ); } +=pod +sub key_exists { + my $self = shift; + my ($trans_id, $base_offset, $key) = @_; + + my ($_val_offset, $_is_del) = $self->_find_value_offset({ + offset => $base_offset, + trans_id => $trans_id, + allow_head => 1, + }); + die "Attempt to use a deleted value" if $_is_del; + die "Internal error!" if !$_val_offset; + + my ($key_offset) = $self->_find_key_offset({ + offset => $_val_offset, + key_md5 => $self->_apply_digest( $key ), + create => 0, + }); + return if !$key_offset; + + my ($val_offset, $is_del) = $self->_find_value_offset({ + offset => $key_offset, + trans_id => $trans_id, + allow_head => 1, + }); + + return 1 if $is_del; + + die "Internal error!" if !$_val_offset; + return ''; +} +=cut + sub get_next_key { my $self = shift; my ($trans_id, $offset) = @_;