daybreak 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/LICENSE +1 -1
- data/README +2 -2
- data/lib/daybreak/db.rb +1 -1
- data/lib/daybreak/journal.rb +19 -16
- data/lib/daybreak/version.rb +1 -1
- metadata +2 -2
data/.travis.yml
CHANGED
data/LICENSE
CHANGED
data/README
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
|
6
6
|
Daybreak is a simple key value store for ruby. It has user defined persistence,
|
7
7
|
and all data is stored in a table in memory so ruby niceties are available.
|
8
|
-
Daybreak is faster than any other ruby options like pstore
|
8
|
+
Daybreak is faster than any other ruby options like pstore or dbm.
|
9
9
|
|
10
10
|
$ gem install daybreak
|
11
11
|
|
12
|
-
You find
|
12
|
+
You can find detailed documentation at http://propublica.github.com/daybreak.
|
data/lib/daybreak/db.rb
CHANGED
@@ -257,7 +257,7 @@ module Daybreak
|
|
257
257
|
# @private
|
258
258
|
def self.exit_handler
|
259
259
|
loop do
|
260
|
-
db = @@databases_mutex.synchronize { @@databases.
|
260
|
+
db = @@databases_mutex.synchronize { @@databases.shift }
|
261
261
|
break unless db
|
262
262
|
warn "Daybreak database #{db.file} was not closed, state might be inconsistent"
|
263
263
|
begin
|
data/lib/daybreak/journal.rb
CHANGED
@@ -138,26 +138,29 @@ module Daybreak
|
|
138
138
|
|
139
139
|
# Worker thread
|
140
140
|
def worker
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
141
|
+
while (record = first)
|
142
|
+
tries = 0
|
143
|
+
begin
|
144
|
+
if Hash === record
|
145
|
+
# Write batch update
|
146
|
+
write(dump(record))
|
147
|
+
@size += record.size
|
148
|
+
else
|
149
|
+
# Write single record
|
150
|
+
record[1] = @serializer.dump(record.last) if record.size > 1
|
151
|
+
write(@format.dump(record))
|
152
|
+
@size += 1
|
153
|
+
end
|
154
|
+
rescue Exception => ex
|
155
|
+
tries += 1
|
156
|
+
warn "Daybreak worker, try #{tries}: #{ex.message}"
|
157
|
+
tries <= 3 ? retry : raise
|
158
|
+
ensure
|
148
159
|
pop
|
149
|
-
break
|
150
|
-
else
|
151
|
-
# Write single record
|
152
|
-
record[1] = @serializer.dump(record.last) if record.size > 1
|
153
|
-
write(@format.dump(record))
|
154
|
-
@size += 1
|
155
160
|
end
|
156
|
-
pop
|
157
161
|
end
|
158
162
|
rescue Exception => ex
|
159
|
-
warn "Daybreak worker: #{ex.message}"
|
160
|
-
retry
|
163
|
+
warn "Daybreak worker terminated: #{ex.message}"
|
161
164
|
end
|
162
165
|
|
163
166
|
# Write data to output stream and advance @pos
|
data/lib/daybreak/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: daybreak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jeff Larson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|