$self->{$param} = $args->{$param};
}
- $self->{engine}->setup_fh( $self );
+ $self->_engine->setup_fh( $self );
$self->{fileobj}->set_db( $self );
$self->unlock();
$self->_fileobj->close;
$self->_fileobj->open;
- $self->{engine}->setup_fh( $self );
+ $self->_engine->setup_fh( $self );
return 1;
}
# Accessor methods
##
+sub _engine {
+ my $self = $_[0]->_get_self;
+ return $self->{engine};
+}
+
sub _fileobj {
my $self = $_[0]->_get_self;
return $self->{fileobj};
##
$self->lock( LOCK_EX );
- my $md5 = $self->{engine}{digest}->($key);
+ my $md5 = $self->_engine->{digest}->($key);
- my $tag = $self->{engine}->find_bucket_list( $self->_base_offset, $md5, { create => 1 } );
+ my $tag = $self->_engine->find_blist( $self->_base_offset, $md5, { create => 1 } );
# User may be storing a hash, in which case we do not want it run
# through the filtering system
##
# Add key/value to bucket list
##
- $self->{engine}->add_bucket( $tag, $md5, $key, $value, undef, $orig_key );
+ $self->_engine->add_bucket( $tag, $md5, $key, $value, undef, $orig_key );
$self->unlock();
my $self = shift->_get_self;
my ($key, $orig_key) = @_;
- my $md5 = $self->{engine}{digest}->($key);
+ my $md5 = $self->_engine->{digest}->($key);
##
# Request shared lock for reading
##
$self->lock( LOCK_SH );
- my $tag = $self->{engine}->find_bucket_list( $self->_base_offset, $md5 );#, { create => 1 } );
+ my $tag = $self->_engine->find_blist( $self->_base_offset, $md5 );#, { create => 1 } );
#XXX This needs to autovivify
if (!$tag) {
$self->unlock();
##
# Get value from bucket list
##
- my $result = $self->{engine}->get_bucket_value( $tag, $md5, $orig_key );
+ my $result = $self->_engine->get_bucket_value( $tag, $md5, $orig_key );
$self->unlock();
##
$self->lock( LOCK_EX );
- my $md5 = $self->{engine}{digest}->($key);
+ my $md5 = $self->_engine->{digest}->($key);
- my $tag = $self->{engine}->find_bucket_list( $self->_base_offset, $md5 );
+ my $tag = $self->_engine->find_blist( $self->_base_offset, $md5 );
if (!$tag) {
$self->unlock();
return;
##
# Delete bucket
##
- my $value = $self->{engine}->get_bucket_value( $tag, $md5 );
+ my $value = $self->_engine->get_bucket_value( $tag, $md5 );
if (defined $value && !ref($value) && $self->_fileobj->{filter_fetch_value}) {
$value = $self->_fileobj->{filter_fetch_value}->($value);
}
- my $result = $self->{engine}->delete_bucket( $tag, $md5, $orig_key );
+ my $result = $self->_engine->delete_bucket( $tag, $md5, $orig_key );
##
# If this object is an array and the key deleted was on the end of the stack,
my $self = shift->_get_self;
my ($key) = @_;
- my $md5 = $self->{engine}{digest}->($key);
+ my $md5 = $self->_engine->{digest}->($key);
##
# Request shared lock for reading
##
$self->lock( LOCK_SH );
- my $tag = $self->{engine}->find_bucket_list( $self->_base_offset, $md5 );
+ my $tag = $self->_engine->find_blist( $self->_base_offset, $md5 );
if (!$tag) {
$self->unlock();
##
# Check if bucket exists and return 1 or ''
##
- my $result = $self->{engine}->bucket_exists( $tag, $md5 ) || '';
+ my $result = $self->_engine->bucket_exists( $tag, $md5 ) || '';
$self->unlock();
$self->lock( LOCK_EX );
#XXX This needs updating to use _release_space
- $self->{engine}->write_tag(
+ $self->_engine->write_tag(
$self->_base_offset, $self->_type,
- chr(0)x$self->{engine}{index_size},
+ chr(0)x$self->_engine->{index_size},
);
$self->unlock();
}
}
- $key = pack($self->{engine}{long_pack}, $key);
+ $key = pack($self->_engine->{long_pack}, $key);
}
my $rv = $self->SUPER::FETCH( $key, $orig_key );
}
}
- $key = pack($self->{engine}{long_pack}, $key);
+ $key = pack($self->_engine->{long_pack}, $key);
}
my $rv = $self->SUPER::STORE( $key, $value, $orig_key );
}
}
- $key = pack($self->{engine}{long_pack}, $key);
+ $key = pack($self->_engine->{long_pack}, $key);
}
my $rv = $self->SUPER::EXISTS( $key );
}
}
- $key = pack($self->{engine}{long_pack}, $key);
+ $key = pack($self->_engine->{long_pack}, $key);
}
my $rv = $self->SUPER::DELETE( $key, $orig );
$self->unlock;
if ($packed_size) {
- return int(unpack($self->{engine}{long_pack}, $packed_size));
+ return int(unpack($self->_engine->{long_pack}, $packed_size));
}
return 0;
my $SAVE_FILTER = $self->_fileobj->{filter_store_value};
$self->_fileobj->{filter_store_value} = undef;
- my $result = $self->STORE('length', pack($self->{engine}{long_pack}, $new_length), 'length');
+ my $result = $self->STORE('length', pack($self->_engine->{long_pack}, $new_length), 'length');
$self->_fileobj->{filter_store_value} = $SAVE_FILTER;