daybreak 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/daybreak.gemspec +1 -0
- data/lib/daybreak/db.rb +1 -1
- data/lib/daybreak/version.rb +1 -1
- data/lib/daybreak/writer.rb +9 -3
- data/test/test.rb +0 -3
- metadata +19 -3
data/.gitignore
CHANGED
data/daybreak.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.licenses = ["MIT"]
|
16
16
|
gem.version = Daybreak::VERSION
|
17
|
+
gem.add_development_dependency 'minitest'
|
17
18
|
gem.add_development_dependency 'simplecov'
|
18
19
|
gem.add_development_dependency 'ruby-prof'
|
19
20
|
end
|
data/lib/daybreak/db.rb
CHANGED
@@ -145,6 +145,7 @@ module Daybreak
|
|
145
145
|
|
146
146
|
# Empty this database
|
147
147
|
empty!
|
148
|
+
close!
|
148
149
|
|
149
150
|
# Move the copy into place
|
150
151
|
tmp_file.close
|
@@ -152,7 +153,6 @@ module Daybreak
|
|
152
153
|
tmp_file.unlink
|
153
154
|
|
154
155
|
# Reset this database
|
155
|
-
close!
|
156
156
|
reset!
|
157
157
|
read!
|
158
158
|
end
|
data/lib/daybreak/version.rb
CHANGED
data/lib/daybreak/writer.rb
CHANGED
@@ -45,8 +45,10 @@ module Daybreak
|
|
45
45
|
@fd = File.open @file, 'a'
|
46
46
|
@fd.binmode
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
if defined?(Fcntl::O_NONBLOCK)
|
49
|
+
f = @fd.fcntl(Fcntl::F_GETFL, 0)
|
50
|
+
@fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | f)
|
51
|
+
end
|
50
52
|
end
|
51
53
|
|
52
54
|
# Workers handle the actual fiddly bits of asynchronous io and
|
@@ -89,7 +91,11 @@ module Daybreak
|
|
89
91
|
# If the write fails try again.
|
90
92
|
def try_write(fd, buf)
|
91
93
|
begin
|
92
|
-
|
94
|
+
if defined?(Fcntl::O_NONBLOCK)
|
95
|
+
s = fd.write_nonblock(buf)
|
96
|
+
else
|
97
|
+
s = fd.write(buf)
|
98
|
+
end
|
93
99
|
if s < buf.length
|
94
100
|
buf = buf[s..-1] # didn't finish
|
95
101
|
else
|
data/test/test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daybreak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11
|
12
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: minitest
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: simplecov
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
107
|
version: '0'
|
92
108
|
requirements: []
|
93
109
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.8.
|
110
|
+
rubygems_version: 1.8.24
|
95
111
|
signing_key:
|
96
112
|
specification_version: 3
|
97
113
|
summary: Daybreak provides an in memory key-value store that is easily enumerable
|