daybreak 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/daybreak/db.rb +2 -0
- data/lib/daybreak/reader.rb +3 -7
- data/lib/daybreak/version.rb +1 -1
- data/lib/daybreak/writer.rb +2 -2
- data/test/test.rb +8 -0
- metadata +20 -20
data/lib/daybreak/db.rb
CHANGED
data/lib/daybreak/reader.rb
CHANGED
@@ -10,7 +10,7 @@ module Daybreak
|
|
10
10
|
|
11
11
|
# Close the Reader's file descriptor.
|
12
12
|
def close!
|
13
|
-
@fd.close unless @fd.nil?
|
13
|
+
@fd.close unless @fd.nil? || !@fd.closed?
|
14
14
|
end
|
15
15
|
|
16
16
|
# Read all values from the aof file.
|
@@ -19,19 +19,15 @@ module Daybreak
|
|
19
19
|
# close and reread the whole db file, but since cross process
|
20
20
|
# consistency is handled by the user, this should be fair warning.
|
21
21
|
def read(&blk)
|
22
|
-
|
22
|
+
open!
|
23
23
|
while !@fd.eof?
|
24
24
|
blk.call(Record.read(@fd))
|
25
25
|
end
|
26
|
+
close!
|
26
27
|
end
|
27
28
|
|
28
29
|
private
|
29
30
|
|
30
|
-
def reopen!
|
31
|
-
close!
|
32
|
-
open!
|
33
|
-
end
|
34
|
-
|
35
31
|
def open!
|
36
32
|
@fd = File.open @file_name, 'r'
|
37
33
|
@fd.binmode
|
data/lib/daybreak/version.rb
CHANGED
data/lib/daybreak/writer.rb
CHANGED
data/test/test.rb
CHANGED
@@ -111,6 +111,14 @@ describe "database functions" do
|
|
111
111
|
assert_equal db2['two'], nil
|
112
112
|
end
|
113
113
|
|
114
|
+
it "should close and reopen the file when clearing the database" do
|
115
|
+
begin
|
116
|
+
1000.times {@db.clear}
|
117
|
+
rescue
|
118
|
+
flunk
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
114
122
|
after do
|
115
123
|
@db.empty!
|
116
124
|
@db.close!
|
metadata
CHANGED
@@ -1,64 +1,64 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daybreak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
5
4
|
prerelease:
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jeff Larson
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
20
|
+
none: false
|
21
|
+
name: minitest
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
26
|
- - ! '>='
|
28
27
|
- !ruby/object:Gem::Version
|
29
28
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: simplecov
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
29
|
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
34
32
|
requirements:
|
35
33
|
- - ! '>='
|
36
34
|
- !ruby/object:Gem::Version
|
37
35
|
version: '0'
|
36
|
+
none: false
|
37
|
+
name: simplecov
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
|
-
|
41
|
-
none: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
42
41
|
requirements:
|
43
42
|
- - ! '>='
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: ruby-prof
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
45
|
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
48
|
requirements:
|
51
49
|
- - ! '>='
|
52
50
|
- !ruby/object:Gem::Version
|
53
51
|
version: '0'
|
52
|
+
none: false
|
53
|
+
name: ruby-prof
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
|
-
|
57
|
-
none: false
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - ! '>='
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
61
|
+
none: false
|
62
62
|
description: A simple dimple key-value store for ruby.
|
63
63
|
email:
|
64
64
|
- thejefflarson@gmail.com
|
@@ -94,20 +94,20 @@ rdoc_options: []
|
|
94
94
|
require_paths:
|
95
95
|
- lib
|
96
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
97
|
requirements:
|
99
98
|
- - ! '>='
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '0'
|
102
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
101
|
none: false
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
103
|
requirements:
|
105
104
|
- - ! '>='
|
106
105
|
- !ruby/object:Gem::Version
|
107
106
|
version: '0'
|
107
|
+
none: false
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.8.
|
110
|
+
rubygems_version: 1.8.23
|
111
111
|
signing_key:
|
112
112
|
specification_version: 3
|
113
113
|
summary: Daybreak provides an in memory key-value store that is easily enumerable
|