Skip to content

Commit

Permalink
some specs for skiplist volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Andreev committed Apr 28, 2008
1 parent 0445bb6 commit 8f0fad9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/strokedb/volumes/skiplist_volume.rb
Expand Up @@ -196,6 +196,8 @@ def replay_log!(log_path, list)
checksum_length = CHECKSUM_LENGTH
msg_range = (0..-(1 + checksum_length))

@log_bytes = 0

File.open(@log_path, "r") do |f|
msg_length = f.read(4).unpack(nf).first rescue nil
(!msg_length || msg_length > max_msg_length) and raise LogFormatError, "Wrong WAL message length prefix!"
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/strokedb/volumes/skiplist_volume_spec.rb
Expand Up @@ -56,10 +56,16 @@
@volume.insert("k2", "v2")

@volume.close!
@volume.find("k").should == "v"
@volume.find("k2").should == "v2"

lambda { @volume.insert("k3", "v3") }.should raise_error(SkiplistVolume::VolumeClosedException)
@volume.find("k3").should == nil

@volume = SkiplistVolume.new(:path => @path, :max_log_size => 1024, :silent => true)
@volume.find("k").should == "v"
@volume.find("k2").should == "v2"
@volume.find("k3").should == nil
end

end
Expand Down

0 comments on commit 8f0fad9

Please sign in to comment.