zillabyte 0.9.7 → 0.9.9
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 +4 -4
- data/ruby/lib/zillabyte/harness/app.rb +37 -7
- data/ruby/lib/zillabyte/harness/base.rb +28 -0
- data/ruby/lib/zillabyte/harness/component.rb +4 -0
- data/ruby/lib/zillabyte/harness/injected_component.rb +11 -4
- data/ruby/lib/zillabyte/harness/sink.rb +6 -5
- data/ruby/lib/zillabyte/harness/source.rb +6 -5
- data/ruby/lib/zillabyte/harness/stream.rb +1 -0
- data/ruby/lib/zillabyte/harness/stream_builder.rb +20 -1
- data/ruby/lib/zillabyte/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17fe4f4d78abd8577811505fc480db3714eaafa5
|
4
|
+
data.tar.gz: 46dba9537746b0dd6f7c41825a00b3deb91d269b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a926a7beeeb77de3ac37838af7fedeac12802b958d02ed453b75b9d806b74966a27831564e752bf4bd12a3c0b7100ef6cabbe67c749473f192558b1809e8267f
|
7
|
+
data.tar.gz: 07b329196b76990a06315fa7fe36df5fb7a63b2f696d7c1715522eebbcbc808a80c3d04badbcc797ce616e82652f5e4b6ad3536114101bb6a5708a3bce03aec8
|
@@ -20,13 +20,43 @@ class Zillabyte::Harness::App < Zillabyte::Harness::Base
|
|
20
20
|
h
|
21
21
|
end
|
22
22
|
|
23
|
+
|
23
24
|
def source(*args, &block)
|
24
|
-
|
25
|
-
stream = op.build_multilang_operation("source", *args, &block)
|
26
|
-
.add_operation_properties_to_info(:name, :type)
|
27
|
-
.add_optional_operation_properties_to_info(:relation, :matches, :end_cycle_policy)
|
28
|
-
.handle_operation
|
29
|
-
.get_output_streams
|
30
|
-
return Zillabyte::Harness::StreamBuilder.new(stream)
|
25
|
+
_source_common(Zillabyte::Harness::Stream, *args, &block)
|
31
26
|
end
|
27
|
+
|
28
|
+
|
29
|
+
def source_from_redshift(*args, &block)
|
30
|
+
_source_common(Zillabyte::Harness::Stream, *args, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def sink_to_redshift(*args, &block)
|
35
|
+
_source_common(Zillabyte::Harness::Stream, *args, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def source_from_kinesis(*args, &block)
|
40
|
+
_source_common(Zillabyte::Harness::Stream, "kinesis_demo_source")
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def sink_to_kinesis(*args, &block)
|
45
|
+
_source_common(Zillabyte::Harness::Stream, "kinesis_demo_sink")
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
def call_component(*args, &block)
|
51
|
+
op = Zillabyte::Harness::OperationHandler.new(self, Zillabyte::Harness::Stream)
|
52
|
+
op = op.build_multilang_operation("component", self, *args, &block)
|
53
|
+
.add_operation_properties_to_info(:name, :type, :id, :output_format)
|
54
|
+
node = op.node
|
55
|
+
streams = op.handle_operation.get_output_streams
|
56
|
+
return Zillabyte::Harness::StreamBuilder.new(streams)
|
57
|
+
end
|
58
|
+
alias_method :executes, :call_component
|
59
|
+
alias_method :execute, :call_component
|
60
|
+
|
61
|
+
|
32
62
|
end
|
@@ -8,4 +8,32 @@ class Zillabyte::Harness::Base
|
|
8
8
|
@_name = name
|
9
9
|
end
|
10
10
|
|
11
|
+
def params
|
12
|
+
# Params are set by the caller (JVM) in the form of env variables. Why env variables? Because we want to
|
13
|
+
# expose the params as soon as possible, in case the user makes static-decisions (i.e. configuring the number
|
14
|
+
# of operaitons in a chain, etc).
|
15
|
+
if @_params.nil?
|
16
|
+
if ENV['ZILLABYTE_PARAMS']
|
17
|
+
@_params = JSON.parse(ENV['ZILLABYTE_PARAMS'])
|
18
|
+
else
|
19
|
+
@_params = {}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
return @_params
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def _source_common(stream_class, *args, &block)
|
29
|
+
op = Zillabyte::Harness::OperationHandler.new(self, stream_class)
|
30
|
+
stream = op.build_multilang_operation("source", *args, &block)
|
31
|
+
.add_operation_properties_to_info(:name, :type)
|
32
|
+
.add_optional_operation_properties_to_info(:relation, :matches, :end_cycle_policy)
|
33
|
+
.handle_operation
|
34
|
+
.get_output_streams
|
35
|
+
return Zillabyte::Harness::StreamBuilder.new(stream)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
11
39
|
end
|
@@ -18,6 +18,10 @@ class Zillabyte::Harness::Component < Zillabyte::Harness::Base
|
|
18
18
|
end
|
19
19
|
h
|
20
20
|
end
|
21
|
+
|
22
|
+
def source(*args, &block)
|
23
|
+
_source_common(Zillabyte::Harness::ComponentStream, *args, &block)
|
24
|
+
end
|
21
25
|
|
22
26
|
def inputs(*args, &block)
|
23
27
|
op = Zillabyte::Harness::OperationHandler.new(self, Zillabyte::Harness::ComponentStream)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Zillabyte::Harness::InjectedComponent
|
2
|
-
attr_accessor :_app, :_node, :_id, :_input_stream_1
|
2
|
+
attr_accessor :_app, :_node, :_id, :_input_stream_1, :_options
|
3
3
|
|
4
4
|
class Node
|
5
5
|
attr_accessor :_name, :_type, :_id, :_consumes, :_emits, :_output_format
|
@@ -20,7 +20,13 @@ class Zillabyte::Harness::InjectedComponent
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def additional_inputs(*v)
|
23
|
-
|
23
|
+
v.each do |vv|
|
24
|
+
if vv.is_a?(Zillabyte::Harness::StreamBuilder)
|
25
|
+
@_consumes.push(vv._last_stream)
|
26
|
+
else
|
27
|
+
@_consumes.push(vv)
|
28
|
+
end
|
29
|
+
end
|
24
30
|
end
|
25
31
|
|
26
32
|
def outputs(*v)
|
@@ -34,8 +40,9 @@ class Zillabyte::Harness::InjectedComponent
|
|
34
40
|
|
35
41
|
def initialize(app, *args)
|
36
42
|
@_app = app
|
37
|
-
@
|
38
|
-
@
|
43
|
+
@_args, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
44
|
+
@_input_stream_1 = @_args[0]
|
45
|
+
@_id = @_args[1]
|
39
46
|
end
|
40
47
|
|
41
48
|
def build_node(&block)
|
@@ -27,9 +27,10 @@ class Zillabyte::Harness::Sink
|
|
27
27
|
class Node
|
28
28
|
attr_accessor :_name, :_relation, :_type, :_columns, :_scope
|
29
29
|
|
30
|
-
def initialize()
|
30
|
+
def initialize(args, options)
|
31
31
|
@_type = 'sink'
|
32
|
-
@_columns = []
|
32
|
+
@_columns = options[:columns] || []
|
33
|
+
@_name = options[:name] || args.first
|
33
34
|
end
|
34
35
|
|
35
36
|
def name(v)
|
@@ -52,12 +53,12 @@ class Zillabyte::Harness::Sink
|
|
52
53
|
|
53
54
|
def initialize(app, *args)
|
54
55
|
@_app = app
|
55
|
-
@
|
56
|
+
@_args, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
56
57
|
end
|
57
58
|
|
58
59
|
def build_node(&block)
|
59
|
-
@_node = Node.new
|
60
|
-
@_node.instance_eval(&block)
|
60
|
+
@_node = Node.new(@_args, @_options)
|
61
|
+
@_node.instance_eval(&block) if block_given?
|
61
62
|
Zillabyte::Harness::Helper.check_sink(@_node, @_app._nodes)
|
62
63
|
@_node._relation ||= @_node._name
|
63
64
|
end
|
@@ -56,15 +56,16 @@
|
|
56
56
|
# end
|
57
57
|
# end
|
58
58
|
class Zillabyte::Harness::Source
|
59
|
-
attr_accessor :_app, :_node, :_relation
|
59
|
+
attr_accessor :_app, :_node, :_relation, :_options
|
60
60
|
|
61
61
|
class Node < Zillabyte::Harness::CommonNode
|
62
62
|
attr_accessor :_matches, :_relation, :_end_cycle_policy, :_begin_cycle, :_next_tuple
|
63
63
|
|
64
|
-
def initialize()
|
65
|
-
@_name = "source_"+Zillabyte::Harness::Counter.get()
|
64
|
+
def initialize(options = {})
|
65
|
+
@_name = options[:name] || "source_"+Zillabyte::Harness::Counter.get()
|
66
66
|
@_type = 'source'
|
67
67
|
@_end_cycle_policy = :null_emit
|
68
|
+
@_options = options
|
68
69
|
end
|
69
70
|
|
70
71
|
def matches(v, options = {})
|
@@ -96,11 +97,11 @@ class Zillabyte::Harness::Source
|
|
96
97
|
|
97
98
|
def initialize(app, *args)
|
98
99
|
@_app = app
|
99
|
-
@_args = args
|
100
|
+
@_args, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
100
101
|
end
|
101
102
|
|
102
103
|
def build_node(&block)
|
103
|
-
@_node = Node.new
|
104
|
+
@_node = Node.new(@_options)
|
104
105
|
# Are we given a block?
|
105
106
|
if block_given?
|
106
107
|
@_node.instance_eval(&block)
|
@@ -1,7 +1,14 @@
|
|
1
1
|
class Zillabyte::Harness::StreamBuilder < Array
|
2
2
|
|
3
3
|
def initialize(first_stream)
|
4
|
-
|
4
|
+
if first_stream.is_a?(Array)
|
5
|
+
@_streams = nil
|
6
|
+
first_stream.each_with_index do |s, i|
|
7
|
+
self[i] = s
|
8
|
+
end
|
9
|
+
else
|
10
|
+
@_streams = [first_stream]
|
11
|
+
end
|
5
12
|
end
|
6
13
|
|
7
14
|
# Override these methods explicitly because they are provided by 'Array'
|
@@ -13,10 +20,22 @@ class Zillabyte::Harness::StreamBuilder < Array
|
|
13
20
|
_handle_function(:group_by, *args, &block)
|
14
21
|
end
|
15
22
|
|
23
|
+
def count(*args, &block)
|
24
|
+
_handle_function(:count, *args, &block)
|
25
|
+
end
|
26
|
+
|
16
27
|
def map(*args, &block)
|
17
28
|
raise "Unsupported"
|
18
29
|
end
|
19
30
|
|
31
|
+
|
32
|
+
|
33
|
+
# 'clones' the stream.
|
34
|
+
# TODO: docs
|
35
|
+
def tee
|
36
|
+
return Zillabyte::Harness::StreamBuilder.new(@_streams.last)
|
37
|
+
end
|
38
|
+
|
20
39
|
|
21
40
|
|
22
41
|
def [](v)
|
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.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zillabyte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.
|
40
|
+
version: 0.9.9
|
41
41
|
description: The Official Zillabyte Gem
|
42
42
|
email:
|
43
43
|
- gem@zillabyte.com
|