bitcask 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -165,7 +165,12 @@ EOF
165
165
  if h = d.hint_file
166
166
  h.each do |e|
167
167
  if f[e.key, nil]
168
- keys << e.key
168
+ e = d[e.value_pos, e.value_sz]
169
+ if e.value == Bitcask::TOMBSTONE
170
+ keys.delete e.key
171
+ elsif f[e.key, e.value]
172
+ keys << e.key
173
+ end
169
174
  end
170
175
  end
171
176
  else
@@ -29,6 +29,27 @@ class Bitcask
29
29
  @keydir.data_files[index.file_id][index.value_pos, index.value_sz].value
30
30
  end
31
31
 
32
+ # Close filehandles and keydir
33
+ def close
34
+ close_filehandles
35
+ close_keydir
36
+ end
37
+
38
+ # Close all filehandles loaded by the keydir.
39
+ def close_filehandles
40
+ @keydir.data_files.each do |data_file|
41
+ data_file.close
42
+ if h = data_file.instance_variable_get('@hint_file')
43
+ h.close
44
+ end
45
+ end
46
+ end
47
+
48
+ # Close the keydir.
49
+ def close_keydir
50
+ @keydir = nil
51
+ end
52
+
32
53
  # Returns a list of all data filenames in this bitcask, sorted from oldest
33
54
  # to newest.
34
55
  def data_file_names
@@ -18,6 +18,10 @@ class Bitcask::DataFile
18
18
  seek offset
19
19
  read size
20
20
  end
21
+
22
+ def close
23
+ @file.close
24
+ end
21
25
 
22
26
  # Iterates over every entry in this file, yielding an Entry.
23
27
  # Options:
@@ -19,7 +19,11 @@ class Bitcask::HintFile
19
19
  seek offset
20
20
  read
21
21
  end
22
-
22
+
23
+ def close
24
+ @file.close
25
+ end
26
+
23
27
  # Iterates over every entry in this file, yielding an Entry.
24
28
  # Options:
25
29
  # :rewind (true) - Rewind the file to the beginning, instead of starting
@@ -1,3 +1,3 @@
1
1
  class Bitcask
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,72 +1,54 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bitcask
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Kyle Kingsbury
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-06-29 00:00:00 -07:00
18
- default_executable:
12
+ date: 2012-03-19 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description:
22
15
  email: aphyr@aphyr.com
23
- executables:
16
+ executables:
24
17
  - bitcask
25
18
  extensions: []
26
-
27
19
  extra_rdoc_files: []
28
-
29
- files:
20
+ files:
30
21
  - bin/bitcask
31
22
  - lib/bitcask.rb
32
- - lib/bitcask/data_file.rb
23
+ - lib/bitcask/keydir.rb
33
24
  - lib/bitcask/version.rb
34
25
  - lib/bitcask/errors.rb
26
+ - lib/bitcask/data_file.rb
35
27
  - lib/bitcask/hint_file.rb
36
- - lib/bitcask/keydir.rb
37
28
  - LICENSE
38
29
  - README.markdown
39
- has_rdoc: true
40
30
  homepage: https://github.com/aphyr/bitcask-ruby
41
31
  licenses: []
42
-
43
32
  post_install_message:
44
33
  rdoc_options: []
45
-
46
- require_paths:
34
+ require_paths:
47
35
  - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
49
- requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- segments:
53
- - 1
54
- - 8
55
- - 6
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
56
41
  version: 1.8.6
57
- required_rubygems_version: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- segments:
62
- - 0
63
- version: "0"
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
64
48
  requirements: []
65
-
66
49
  rubyforge_project: bitcask
67
- rubygems_version: 1.3.6
50
+ rubygems_version: 1.8.15
68
51
  signing_key:
69
52
  specification_version: 3
70
53
  summary: An (incomplete) interface to the Bitcask storage system
71
54
  test_files: []
72
-