All sectors now use a string to create themselves
rkinyon@cpan.org [Mon, 16 Jun 2008 01:22:02 +0000 (01:22 +0000)]
git-svn-id: http://svn.ali.as/cpan/trunk/DBM-Deep@3577 88f4d9cd-8a04-0410-9d60-8f63309c3137

Changes
lib/DBM/Deep/Engine/Sector/BucketList.pm
lib/DBM/Deep/Engine/Sector/Index.pm
lib/DBM/Deep/Engine/Sector/Reference.pm

diff --git a/Changes b/Changes
index df913f7..b7d0612 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
 Revision history for DBM::Deep.
 
+1.0014 Jun 13 23:15:00 2008 EST
+    - (This version is compatible with 1.0013)
+    - Fix for RT#36781 (t/44 has an unrequired dependency)
+    - Start the process of optimization.
+
 1.0013 Jun 13 23:15:00 2008 EST
     - (This version is compatible with 1.0012)
     - Fix for RT#30144 (Optimization failure on Win32)
index b76b2dd..dd2ece4 100644 (file)
@@ -15,14 +15,11 @@ sub _init {
     my $engine = $self->engine;
 
     unless ( $self->offset ) {
-        my $leftover = $self->size - $self->base_size;
-
         $self->{offset} = $engine->_request_blist_sector( $self->size );
-        $engine->storage->print_at( $self->offset, $engine->SIG_BLIST ); # Sector type
-        # Skip staleness counter
-        $engine->storage->print_at( $self->offset + $self->base_size,
-            chr(0) x $leftover, # Zero-fill the data
-        );
+
+        my $string = chr(0) x $self->size;
+        substr( $string, 0, 1, $engine->SIG_BLIST );
+        $engine->storage->print_at( $self->offset, $string );
     }
 
     if ( $self->{key_md5} ) {
index 149f271..e314602 100644 (file)
@@ -15,14 +15,11 @@ sub _init {
     my $engine = $self->engine;
 
     unless ( $self->offset ) {
-        my $leftover = $self->size - $self->base_size;
-
         $self->{offset} = $engine->_request_index_sector( $self->size );
-        $engine->storage->print_at( $self->offset, $engine->SIG_INDEX ); # Sector type
-        # Skip staleness counter
-        $engine->storage->print_at( $self->offset + $self->base_size,
-            chr(0) x $leftover, # Zero-fill the rest
-        );
+
+        my $string = chr(0) x $self->size;
+        substr( $string, 0, 1, $engine->SIG_INDEX );
+        $engine->storage->print_at( $self->offset, $string );
     }
 
     return $self;
index 0fd782a..2d1bff3 100644 (file)
@@ -19,7 +19,6 @@ sub _init {
     my $e = $self->engine;
 
     unless ( $self->offset ) {
-        $self->{staleness} = 0;
         $self->{offset} = $e->_request_data_sector( $self->size );
 
         my $class_offset = 0;
@@ -43,13 +42,13 @@ sub _init {
     }
     else {
         $self->{type} = $e->storage->read_at( $self->offset, 1 );
-
-        $self->{staleness} = unpack(
-            $e->StP($DBM::Deep::Engine::STALE_SIZE),
-            $e->storage->read_at( $self->offset + $e->SIG_SIZE, $DBM::Deep::Engine::STALE_SIZE ),
-        );
     }
 
+    $self->{staleness} = unpack(
+        $e->StP($DBM::Deep::Engine::STALE_SIZE),
+        $e->storage->read_at( $self->offset + $e->SIG_SIZE, $DBM::Deep::Engine::STALE_SIZE ),
+    );
+
     return;
 }