bud 0.1.0.pre1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +23 -0
- data/{README → README.md} +6 -2
- data/docs/cheat.md +1 -8
- data/docs/intro.md +1 -1
- data/lib/bud/aggs.rb +16 -16
- data/lib/bud/bud_meta.rb +8 -15
- data/lib/bud/collections.rb +85 -172
- data/lib/bud/errors.rb +5 -1
- data/lib/bud/executor/elements.rb +133 -118
- data/lib/bud/executor/group.rb +6 -6
- data/lib/bud/executor/join.rb +25 -22
- data/lib/bud/metrics.rb +1 -1
- data/lib/bud/monkeypatch.rb +18 -29
- data/lib/bud/rebl.rb +5 -4
- data/lib/bud/rewrite.rb +21 -160
- data/lib/bud/source.rb +5 -5
- data/lib/bud/state.rb +13 -12
- data/lib/bud/storage/dbm.rb +13 -23
- data/lib/bud/storage/zookeeper.rb +0 -4
- data/lib/bud.rb +184 -162
- metadata +144 -216
- data/docs/deploy.md +0 -96
- data/lib/bud/deploy/countatomicdelivery.rb +0 -38
- data/lib/bud/joins.rb +0 -526
data/lib/bud/storage/dbm.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'dbm'
|
2
2
|
|
3
3
|
module Bud
|
4
|
-
# Persistent table implementation based on
|
4
|
+
# Persistent table implementation based on dbm.
|
5
5
|
class BudDbmTable < BudPersistentCollection # :nodoc: all
|
6
6
|
def initialize(name, bud_instance, given_schema)
|
7
|
-
@invalidated = true
|
8
7
|
dbm_dir = bud_instance.options[:dbm_dir]
|
9
8
|
raise Bud::Error, "dbm support must be enabled via 'dbm_dir'" unless dbm_dir
|
10
9
|
if bud_instance.port.nil?
|
@@ -23,6 +22,7 @@ module Bud
|
|
23
22
|
|
24
23
|
super(name, bud_instance, given_schema)
|
25
24
|
@to_delete = []
|
25
|
+
@invalidated = true
|
26
26
|
|
27
27
|
db_fname = "#{dirname}/#{name}.dbm"
|
28
28
|
flags = DBM::WRCREAT
|
@@ -70,7 +70,6 @@ module Bud
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def make_tuple(k_ary, v_ary)
|
73
|
-
#t = Array.new(k_ary.length + v_ary.length)
|
74
73
|
t = @struct.new
|
75
74
|
@key_colnums.each_with_index do |k,i|
|
76
75
|
t[k] = k_ary[i]
|
@@ -85,7 +84,7 @@ module Bud
|
|
85
84
|
each_from([@delta], &block)
|
86
85
|
each_storage(&block)
|
87
86
|
end
|
88
|
-
|
87
|
+
|
89
88
|
def each_raw(&block)
|
90
89
|
each_storage(&block)
|
91
90
|
end
|
@@ -142,7 +141,7 @@ module Bud
|
|
142
141
|
def tick_deltas
|
143
142
|
unless @delta.empty?
|
144
143
|
merge_to_db(@delta)
|
145
|
-
@tick_delta += @delta.values
|
144
|
+
@tick_delta += @delta.values if accumulate_tick_deltas
|
146
145
|
@delta.clear
|
147
146
|
end
|
148
147
|
unless @new_delta.empty?
|
@@ -151,7 +150,7 @@ module Bud
|
|
151
150
|
end
|
152
151
|
return !(@delta.empty?)
|
153
152
|
end
|
154
|
-
|
153
|
+
|
155
154
|
public
|
156
155
|
def flush_deltas
|
157
156
|
unless @delta.empty?
|
@@ -164,21 +163,20 @@ module Bud
|
|
164
163
|
end
|
165
164
|
|
166
165
|
# This is verbatim from BudTable. Need to DRY up. Should we be a subclass of BudTable?
|
167
|
-
public
|
166
|
+
public
|
168
167
|
def pending_delete(o)
|
169
168
|
if o.class <= Bud::PushElement
|
170
169
|
o.wire_to_delete self
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
170
|
+
elsif o.class <= Bud::BudCollection
|
171
|
+
o.pro.wire_to_delete self
|
172
|
+
else
|
173
|
+
@to_delete = @to_delete + o.map{|t| prep_tuple(t) unless t.nil?}
|
174
|
+
end
|
176
175
|
end
|
177
176
|
superator "<-" do |o|
|
178
177
|
pending_delete(o)
|
179
178
|
end
|
180
|
-
|
181
|
-
|
179
|
+
|
182
180
|
def insert(tuple)
|
183
181
|
key = get_key_vals(tuple)
|
184
182
|
merge_tuple_to_db(key, tuple)
|
@@ -215,15 +213,7 @@ module Bud
|
|
215
213
|
def invalidate_cache
|
216
214
|
end
|
217
215
|
|
218
|
-
|
219
|
-
@dbm.send sym, *args, &block
|
220
|
-
end
|
221
|
-
|
222
|
-
public
|
223
|
-
def length
|
224
|
-
@dbm.length
|
225
|
-
end
|
226
|
-
|
216
|
+
# XXX: shouldn't this check @delta as well?
|
227
217
|
public
|
228
218
|
def empty?
|
229
219
|
@dbm.empty?
|