zillabyte 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGFiZGYyNGE4YTQzNzVhZWM1NTI1OTUzZDk4ZWU2ZGRmYWQxZmJhNw==
4
+ YWQ4MTY0ZGFjZTIxMGJmOGM0NDZlMmI1NTZmOGJhNTg0YWIzMWI2Yg==
5
5
  data.tar.gz: !binary |-
6
- N2QzYWNhNmY4OTUyZWIwODU3NDBiYzA1ZDgyOGIxZTZlNmY2NTlmMQ==
6
+ NzAwM2E3MDY4YzVmMTE3YWNlZGY5NzYyNjQ0N2MyM2MwN2VkMzMwMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTU1NDE2ZGNiODMwYjM2NzY4NDYyMzc1OTY4ZTA2NTg2MjIzNDNiNjk2MzY4
10
- YjJkODU5ZTUwY2YzZTFmZjA3MDI1MGI4YmVhZmRhMDJkZWExNzBhMzhhNTg4
11
- NmExNGViNTZkYWQxM2M2MDRiYzFjNjczNWQ2NmE5YjIzYmQ3YjU=
9
+ ZGRiY2MzZTVkMGRmM2RkZDQ2NzFmYjIyZGY5YWM0NjIzNTkwNmE0YzEwMWMw
10
+ M2EyNTIwZDk4NTc4OTAxYjBjMDMxNWNhNGRmNGUxZDlkZWJhZmQ0M2VjZWIw
11
+ NmExMTNjMThhMTc1ZmZkZTZiYmY2MDM3NDQyMDFiMTc2MmM0ZjA=
12
12
  data.tar.gz: !binary |-
13
- NGYwODkxNGM3OTkxNGM4NTQwY2E4MzdiMjBjYzA0ZGM4YjA4ZTllNGIwYmIy
14
- NmY4ZGEzNmYyZGZiN2FkNDU2YWQ0OTlmZWFjNzIyMDM1NDdiYTE2Mzk4M2M4
15
- MjA0MTczNzEwY2Q0N2FlYTdjYjE2ZjllZWYwNWFmZGFjODg0MDc=
13
+ YmZjZWI4ZjBkYWFhM2VkM2RjNzFkOWY1NTVhM2MzYTVjMzY4NDU3NGExZmM1
14
+ ZDA5Y2RiZTNkMGIyZDk5YmYzODgxN2NlM2M0ZWI5Zjk0MDNlOWRmNDZjOTk4
15
+ OGRhYTRmYzAzZjkzZjNmMjUyMWRkNmFlY2JhZjZlYmQ1ZWJlYTE=
@@ -66,7 +66,7 @@ class Zillabyte::Harness::Helper
66
66
  Zillabyte::Harness::Helper.print_error(msg)
67
67
  end
68
68
 
69
- allowed_policies = [:null_emit, :explicit]
69
+ allowed_policies = [:null_emit, :explicit, :infinite]
70
70
  if !(allowed_policies.member? source._end_cycle_policy)
71
71
  msg = "#{ee}Invalid \"end_cycle_policy\": \"#{source._end_cycle_policy}\". The allowed policies are :null_emit and :explicit. #{pp}"
72
72
  Zillabyte::Harness::Helper.print_error(msg)
@@ -113,6 +113,21 @@ module Zillabyte
113
113
  File.open("#{heartbeat_dir}/#{pid}", "w").close
114
114
  end
115
115
 
116
+
117
+ def set_state(key, val)
118
+ send_msg_to_parent({'set_state' => Base64.encode64(Marshall::dump(val))})
119
+ end
120
+
121
+ def get_state(key)
122
+ send_msg_to_parent({'get_state' => key})
123
+ ret = read_message()
124
+ if ret['state']
125
+ return Marshall.load(Base64.decode64(ret['state']))
126
+ else
127
+ return nil
128
+ end
129
+ end
130
+
116
131
  def emit(*args)
117
132
 
118
133
  stream = nil
@@ -212,6 +227,8 @@ module Zillabyte
212
227
  include Storm::Protocol
213
228
 
214
229
  def begin_cycle(conf, context); end
230
+
231
+ def prepare(conf, context); end
215
232
 
216
233
  def next_tuple; end
217
234
 
@@ -229,6 +246,8 @@ module Zillabyte
229
246
  case msg['command']
230
247
  when 'begin_cycle'
231
248
  begin_cycle
249
+ when 'prepare'
250
+ prepare
232
251
  when 'next'
233
252
  next_tuple
234
253
  when 'ack'
@@ -362,6 +381,10 @@ module Zillabyte
362
381
  def begin_cycle(*args)
363
382
  self.instance_exec(*args, &@harness._begin_cycle) if @harness._begin_cycle
364
383
  end
384
+
385
+ def prepare(*args)
386
+ self.instance_exec(*args, &@harness._prepare) if @harness._prepare
387
+ end
365
388
 
366
389
  def next_tuple
367
390
  self.instance_eval &@harness._next_tuple
@@ -1,5 +1,6 @@
1
1
  class Zillabyte::Harness::Source
2
- attr_accessor :_name, :_type, :_matches, :_relation, :_emits, :_end_cycle_policy, :_begin_cycle, :_next_tuple
2
+
3
+ attr_accessor :_name, :_type, :_matches, :_relation, :_emits, :_end_cycle_policy, :_begin_cycle, :_next_tuple, :_prepare
3
4
 
4
5
  def initialize()
5
6
  @_name = "source_"+Zillabyte::Harness::Counter.get()
@@ -35,5 +36,9 @@ class Zillabyte::Harness::Source
35
36
  def next_tuple(&block)
36
37
  @_next_tuple = block
37
38
  end
39
+
40
+ def prepare(&block)
41
+ @_prepare = block
42
+ end
38
43
 
39
44
  end
@@ -1,3 +1,3 @@
1
1
  module Zillabyte
2
- VERSION = "0.0.22" unless defined?(VERSION)
2
+ VERSION = "0.0.23" unless defined?(VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillabyte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - zillabyte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-09 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.22
47
+ version: 0.0.23
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.22
54
+ version: 0.0.23
55
55
  description: The Official Zillabyte Gem
56
56
  email:
57
57
  - gem@zillabyte.com