bud 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/README +33 -16
  2. data/bin/budplot +42 -65
  3. data/bin/budtimelines +235 -0
  4. data/bin/budvis +24 -122
  5. data/bin/rebl +1 -0
  6. data/docs/README.md +21 -10
  7. data/docs/bfs.md +4 -6
  8. data/docs/c.html +251 -0
  9. data/docs/cheat.md +45 -30
  10. data/docs/deploy.md +26 -26
  11. data/docs/getstarted.md +6 -4
  12. data/docs/visualizations.md +43 -31
  13. data/examples/chat/chat.rb +4 -9
  14. data/examples/chat/chat_server.rb +1 -8
  15. data/examples/deploy/deploy_ip_port +1 -0
  16. data/examples/deploy/keys.rb +5 -0
  17. data/examples/deploy/tokenring-ec2.rb +9 -9
  18. data/examples/deploy/{tokenring-local.rb → tokenring-fork.rb} +3 -5
  19. data/examples/deploy/tokenring-thread.rb +15 -0
  20. data/examples/deploy/tokenring.rb +25 -17
  21. data/lib/bud/aggs.rb +87 -25
  22. data/lib/bud/bud_meta.rb +48 -31
  23. data/lib/bud/bust/bust.rb +16 -15
  24. data/lib/bud/collections.rb +207 -232
  25. data/lib/bud/depanalysis.rb +1 -0
  26. data/lib/bud/deploy/countatomicdelivery.rb +8 -20
  27. data/lib/bud/deploy/deployer.rb +16 -16
  28. data/lib/bud/deploy/ec2deploy.rb +34 -35
  29. data/lib/bud/deploy/forkdeploy.rb +90 -0
  30. data/lib/bud/deploy/threaddeploy.rb +38 -0
  31. data/lib/bud/graphs.rb +103 -199
  32. data/lib/bud/joins.rb +190 -41
  33. data/lib/bud/monkeypatch.rb +84 -0
  34. data/lib/bud/rebl.rb +8 -1
  35. data/lib/bud/rewrite.rb +152 -49
  36. data/lib/bud/server.rb +1 -0
  37. data/lib/bud/state.rb +24 -10
  38. data/lib/bud/storage/dbm.rb +170 -0
  39. data/lib/bud/storage/tokyocabinet.rb +5 -1
  40. data/lib/bud/stratify.rb +6 -7
  41. data/lib/bud/viz.rb +31 -17
  42. data/lib/bud/viz_util.rb +204 -0
  43. data/lib/bud.rb +271 -244
  44. data/lib/bud.rb.orig +806 -0
  45. metadata +43 -22
  46. data/docs/bfs.raw +0 -251
  47. data/docs/diffs +0 -181
  48. data/examples/basics/out +0 -1103
  49. data/examples/basics/out.new +0 -856
  50. data/lib/bud/deploy/localdeploy.rb +0 -53
data/lib/bud/bust/bust.rb CHANGED
@@ -15,12 +15,6 @@ module Bust
15
15
  # used this for inspiration:
16
16
  # http://blogs.msdn.com/b/abhinaba/archive/2005/10/14/474841.aspx
17
17
 
18
- # allow state to be queried easily
19
- state do
20
- table :t_table_info, [:tab_name, :tab_type]
21
- table :t_table_schema, [:tab_name, :scheme]
22
- end
23
-
24
18
  bootstrap do
25
19
  # copied from peter's code; this should probably be in the Bud runtime or in
26
20
  # some meta module
@@ -34,11 +28,15 @@ module Bust
34
28
  BustClass.new(bud, q)
35
29
  end
36
30
  # Wait for socket to be ready before we return from bootstrap.
37
- @bust_port = q.pop
31
+ r = q.pop
32
+ if r.class <= Exception
33
+ raise r
34
+ else
35
+ @bust_port = r
36
+ end
38
37
  end
39
38
 
40
39
  class BustClass
41
-
42
40
  class BustHandler
43
41
  def initialize(session, request, body, bud)
44
42
  @session = session
@@ -95,17 +93,21 @@ module Bust
95
93
  ensure
96
94
  @session.close
97
95
  end
98
-
99
96
  end
100
97
  end
101
98
 
102
99
  def initialize(bud, q)
103
100
  # allow user-configurable port
104
- server = TCPServer.new(bud.ip, (bud.options[:bust_port] or 0))
105
- port = server.addr[1]
106
- puts "Bust server listening on #{bud.ip}:#{port}"
107
- # We're now ready to accept connections.
108
- q << port
101
+ begin
102
+ server = TCPServer.new(bud.ip, (bud.options[:bust_port] or 0))
103
+ port = server.addr[1]
104
+ puts "Bust server listening on #{bud.ip}:#{port}"
105
+ # We're now ready to accept connections
106
+ q << port
107
+ rescue Exception => e
108
+ # Avoid deadlock on queue, report exception to caller
109
+ q << e
110
+ end
109
111
 
110
112
  loop do
111
113
  session = server.accept
@@ -124,6 +126,5 @@ module Bust
124
126
  end
125
127
  end
126
128
  end
127
-
128
129
  end
129
130
  end