skydb 0.2.3 → 0.3.0
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 +15 -0
- data/README.md +165 -1
- data/lib/skydb.rb +18 -61
- data/lib/skydb/client.rb +186 -186
- data/lib/skydb/event.rb +47 -76
- data/lib/skydb/property.rb +34 -67
- data/lib/skydb/table.rb +121 -41
- data/lib/skydb/version.rb +1 -1
- data/test/integration/client_test.rb +88 -0
- data/test/test_helper.rb +3 -51
- data/test/unit/client_test.rb +135 -32
- metadata +17 -278
- data/bin/sky +0 -89
- data/lib/ext/hash.rb +0 -11
- data/lib/ext/string.rb +0 -11
- data/lib/ext/treetop.rb +0 -19
- data/lib/skydb/action.rb +0 -76
- data/lib/skydb/import.rb +0 -7
- data/lib/skydb/import/importer.rb +0 -435
- data/lib/skydb/import/transforms/apache.yml +0 -4
- data/lib/skydb/import/transforms/sky.yml +0 -28
- data/lib/skydb/import/transforms/snowplow.yml +0 -1
- data/lib/skydb/import/translator.rb +0 -119
- data/lib/skydb/message.rb +0 -146
- data/lib/skydb/message/add_action.rb +0 -53
- data/lib/skydb/message/add_event.rb +0 -72
- data/lib/skydb/message/add_property.rb +0 -55
- data/lib/skydb/message/create_table.rb +0 -64
- data/lib/skydb/message/delete_table.rb +0 -66
- data/lib/skydb/message/get_action.rb +0 -55
- data/lib/skydb/message/get_actions.rb +0 -38
- data/lib/skydb/message/get_properties.rb +0 -38
- data/lib/skydb/message/get_property.rb +0 -55
- data/lib/skydb/message/get_table.rb +0 -74
- data/lib/skydb/message/get_tables.rb +0 -43
- data/lib/skydb/message/lookup.rb +0 -79
- data/lib/skydb/message/lua/aggregate.rb +0 -63
- data/lib/skydb/message/multi.rb +0 -57
- data/lib/skydb/message/next_actions.rb +0 -55
- data/lib/skydb/message/ping.rb +0 -32
- data/lib/skydb/property/type.rb +0 -40
- data/lib/skydb/query.rb +0 -183
- data/lib/skydb/query/after_condition.rb +0 -104
- data/lib/skydb/query/ast/selection_field_syntax_node.rb +0 -26
- data/lib/skydb/query/ast/selection_fields_syntax_node.rb +0 -16
- data/lib/skydb/query/ast/selection_group_syntax_node.rb +0 -16
- data/lib/skydb/query/ast/selection_groups_syntax_node.rb +0 -16
- data/lib/skydb/query/condition.rb +0 -113
- data/lib/skydb/query/on_condition.rb +0 -53
- data/lib/skydb/query/selection.rb +0 -398
- data/lib/skydb/query/selection_field.rb +0 -99
- data/lib/skydb/query/selection_fields_grammar.treetop +0 -46
- data/lib/skydb/query/selection_fields_parse_error.rb +0 -30
- data/lib/skydb/query/selection_group.rb +0 -78
- data/lib/skydb/query/selection_groups_grammar.treetop +0 -31
- data/lib/skydb/query/selection_groups_parse_error.rb +0 -30
- data/lib/skydb/query/validation_error.rb +0 -8
- data/lib/skydb/timestamp.rb +0 -22
- data/test/integration/query_test.rb +0 -102
- data/test/unit/event_test.rb +0 -32
- data/test/unit/import/importer_test.rb +0 -208
- data/test/unit/import/translator_test.rb +0 -88
- data/test/unit/message/add_action_message_test.rb +0 -34
- data/test/unit/message/add_event_message_test.rb +0 -35
- data/test/unit/message/add_property_message_test.rb +0 -41
- data/test/unit/message/create_table_message_test.rb +0 -34
- data/test/unit/message/delete_table_message_test.rb +0 -34
- data/test/unit/message/get_action_message_test.rb +0 -34
- data/test/unit/message/get_actions_message_test.rb +0 -18
- data/test/unit/message/get_properties_message_test.rb +0 -18
- data/test/unit/message/get_property_message_test.rb +0 -34
- data/test/unit/message/get_table_message_test.rb +0 -19
- data/test/unit/message/get_tables_message_test.rb +0 -18
- data/test/unit/message/lookup_message_test.rb +0 -27
- data/test/unit/message/lua_aggregate_message_test.rb +0 -19
- data/test/unit/message/multi_message_test.rb +0 -22
- data/test/unit/message/next_action_message_test.rb +0 -34
- data/test/unit/message/ping_message_test.rb +0 -18
- data/test/unit/message_test.rb +0 -15
- data/test/unit/query/after_test.rb +0 -89
- data/test/unit/query/on_test.rb +0 -71
- data/test/unit/query/selection_test.rb +0 -273
- data/test/unit/query_test.rb +0 -182
- data/test/unit/skydb_test.rb +0 -20
@@ -1,64 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class CreateTable < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'create table' message.
|
11
|
-
#
|
12
|
-
# @param [Table] table the table to create.
|
13
|
-
def initialize(table=nil, options={})
|
14
|
-
super('create_table')
|
15
|
-
self.table = table
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
##########################################################################
|
20
|
-
#
|
21
|
-
# Attributes
|
22
|
-
#
|
23
|
-
##########################################################################
|
24
|
-
|
25
|
-
##################################
|
26
|
-
# Table
|
27
|
-
##################################
|
28
|
-
|
29
|
-
# The talbe to add.
|
30
|
-
attr_reader :table
|
31
|
-
|
32
|
-
def table=(value)
|
33
|
-
@table = value.is_a?(Table) ? value : nil
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
##########################################################################
|
38
|
-
#
|
39
|
-
# Methods
|
40
|
-
#
|
41
|
-
##########################################################################
|
42
|
-
|
43
|
-
##################################
|
44
|
-
# Validation
|
45
|
-
##################################
|
46
|
-
|
47
|
-
# A flag stating if the table is required for this type of message.
|
48
|
-
def require_table?
|
49
|
-
return false
|
50
|
-
end
|
51
|
-
|
52
|
-
####################################
|
53
|
-
# Encoding
|
54
|
-
####################################
|
55
|
-
|
56
|
-
# Encodes the message body.
|
57
|
-
#
|
58
|
-
# @param [IO] buffer the buffer to write the header to.
|
59
|
-
def encode_body(buffer)
|
60
|
-
buffer << table.to_msgpack
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class DeleteTable < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'delete table' message.
|
11
|
-
#
|
12
|
-
# @param [Table] table the table to delete.
|
13
|
-
def initialize(table=nil, options={})
|
14
|
-
super('delete_table')
|
15
|
-
self.table = table
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
##########################################################################
|
20
|
-
#
|
21
|
-
# Attributes
|
22
|
-
#
|
23
|
-
##########################################################################
|
24
|
-
|
25
|
-
##################################
|
26
|
-
# Table
|
27
|
-
##################################
|
28
|
-
|
29
|
-
# The talbe to add.
|
30
|
-
attr_reader :table
|
31
|
-
|
32
|
-
def table=(value)
|
33
|
-
@table = value.is_a?(Table) ? value : nil
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
##########################################################################
|
38
|
-
#
|
39
|
-
# Methods
|
40
|
-
#
|
41
|
-
##########################################################################
|
42
|
-
|
43
|
-
##################################
|
44
|
-
# Validation
|
45
|
-
##################################
|
46
|
-
|
47
|
-
# A flag stating if the table is required for this type of message.
|
48
|
-
def require_table?
|
49
|
-
return false
|
50
|
-
end
|
51
|
-
|
52
|
-
####################################
|
53
|
-
# Encoding
|
54
|
-
####################################
|
55
|
-
|
56
|
-
# Encodes the message body.
|
57
|
-
#
|
58
|
-
# @param [IO] buffer the buffer to write the header to.
|
59
|
-
def encode_body(buffer)
|
60
|
-
buffer << {
|
61
|
-
name: table.name
|
62
|
-
}.to_msgpack
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class GetAction < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'action get' message.
|
11
|
-
#
|
12
|
-
# @param [Fixnum] action_id the identifier of the action to retrieve.
|
13
|
-
def initialize(action_id=nil, options={})
|
14
|
-
super('get_action')
|
15
|
-
self.action_id = action_id
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
##########################################################################
|
20
|
-
#
|
21
|
-
# Attributes
|
22
|
-
#
|
23
|
-
##########################################################################
|
24
|
-
|
25
|
-
##################################
|
26
|
-
# Action ID
|
27
|
-
##################################
|
28
|
-
|
29
|
-
# The action identifier to retrieve.
|
30
|
-
attr_reader :action_id
|
31
|
-
|
32
|
-
def action_id=(value)
|
33
|
-
@action_id = value.to_i
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
##########################################################################
|
38
|
-
#
|
39
|
-
# Methods
|
40
|
-
#
|
41
|
-
##########################################################################
|
42
|
-
|
43
|
-
####################################
|
44
|
-
# Encoding
|
45
|
-
####################################
|
46
|
-
|
47
|
-
# Encodes the message body.
|
48
|
-
#
|
49
|
-
# @param [IO] buffer the buffer to write the header to.
|
50
|
-
def encode_body(buffer)
|
51
|
-
buffer << action_id.to_msgpack
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class GetActions < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'action all' message.
|
11
|
-
def initialize(options={})
|
12
|
-
super('get_actions')
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
##########################################################################
|
17
|
-
#
|
18
|
-
# Methods
|
19
|
-
#
|
20
|
-
##########################################################################
|
21
|
-
|
22
|
-
####################################
|
23
|
-
# Encoding
|
24
|
-
####################################
|
25
|
-
|
26
|
-
# Encodes the message body.
|
27
|
-
#
|
28
|
-
# @param [IO] buffer the buffer to write the header to.
|
29
|
-
def encode_body(buffer)
|
30
|
-
# Do nothing.
|
31
|
-
end
|
32
|
-
|
33
|
-
def process_response(response)
|
34
|
-
return response['actions']
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class GetProperties < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'property all' message.
|
11
|
-
def initialize(options={})
|
12
|
-
super('get_properties')
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
##########################################################################
|
17
|
-
#
|
18
|
-
# Methods
|
19
|
-
#
|
20
|
-
##########################################################################
|
21
|
-
|
22
|
-
####################################
|
23
|
-
# Encoding
|
24
|
-
####################################
|
25
|
-
|
26
|
-
# Encodes the message body.
|
27
|
-
#
|
28
|
-
# @param [IO] buffer the buffer to write the header to.
|
29
|
-
def encode_body(buffer)
|
30
|
-
# Do nothing.
|
31
|
-
end
|
32
|
-
|
33
|
-
def process_response(response)
|
34
|
-
return response['properties']
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class GetProperty < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'property get' message.
|
11
|
-
#
|
12
|
-
# @param [Fixnum] property_id The identifier for the property to retrieve.
|
13
|
-
def initialize(property_id=nil, options={})
|
14
|
-
super('get_property')
|
15
|
-
self.property_id = property_id
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
##########################################################################
|
20
|
-
#
|
21
|
-
# Attributes
|
22
|
-
#
|
23
|
-
##########################################################################
|
24
|
-
|
25
|
-
##################################
|
26
|
-
# Property ID
|
27
|
-
##################################
|
28
|
-
|
29
|
-
# The property identifier to retrieve.
|
30
|
-
attr_reader :property_id
|
31
|
-
|
32
|
-
def property_id=(value)
|
33
|
-
@property_id = value.to_i
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
##########################################################################
|
38
|
-
#
|
39
|
-
# Methods
|
40
|
-
#
|
41
|
-
##########################################################################
|
42
|
-
|
43
|
-
####################################
|
44
|
-
# Encoding
|
45
|
-
####################################
|
46
|
-
|
47
|
-
# Encodes the message body.
|
48
|
-
#
|
49
|
-
# @param [IO] buffer the buffer to write the header to.
|
50
|
-
def encode_body(buffer)
|
51
|
-
buffer << property_id.to_msgpack
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class GetTable < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'get_table' message.
|
11
|
-
#
|
12
|
-
# @param [Fixnum] name the name of the table to retrieve.
|
13
|
-
def initialize(name=nil, options={})
|
14
|
-
super('get_table')
|
15
|
-
self.name = name
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
##########################################################################
|
20
|
-
#
|
21
|
-
# Attributes
|
22
|
-
#
|
23
|
-
##########################################################################
|
24
|
-
|
25
|
-
##################################
|
26
|
-
# Name
|
27
|
-
##################################
|
28
|
-
|
29
|
-
# The name of the table to retrieve.
|
30
|
-
attr_reader :name
|
31
|
-
|
32
|
-
def name=(value)
|
33
|
-
@name = value.to_s
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
##########################################################################
|
38
|
-
#
|
39
|
-
# Methods
|
40
|
-
#
|
41
|
-
##########################################################################
|
42
|
-
|
43
|
-
##################################
|
44
|
-
# Validation
|
45
|
-
##################################
|
46
|
-
|
47
|
-
# A flag stating if the table is required for this type of message.
|
48
|
-
def require_table?
|
49
|
-
return false
|
50
|
-
end
|
51
|
-
|
52
|
-
####################################
|
53
|
-
# Encoding
|
54
|
-
####################################
|
55
|
-
|
56
|
-
# Encodes the message body.
|
57
|
-
#
|
58
|
-
# @param [IO] buffer the buffer to write the header to.
|
59
|
-
def encode_body(buffer)
|
60
|
-
buffer << {
|
61
|
-
name: name
|
62
|
-
}.to_msgpack
|
63
|
-
end
|
64
|
-
|
65
|
-
def process_response(response)
|
66
|
-
if !response.nil? && !response['table'].nil?
|
67
|
-
response = SkyDB::Table.new(response['table']['name'])
|
68
|
-
else
|
69
|
-
return nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class GetTables < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'get_tables' message.
|
11
|
-
def initialize(options={})
|
12
|
-
super('get_tables')
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
##########################################################################
|
17
|
-
#
|
18
|
-
# Methods
|
19
|
-
#
|
20
|
-
##########################################################################
|
21
|
-
|
22
|
-
##################################
|
23
|
-
# Validation
|
24
|
-
##################################
|
25
|
-
|
26
|
-
# A flag stating if the table is required for this type of message.
|
27
|
-
def require_table?
|
28
|
-
return false
|
29
|
-
end
|
30
|
-
|
31
|
-
####################################
|
32
|
-
# Encoding
|
33
|
-
####################################
|
34
|
-
|
35
|
-
def process_response(response)
|
36
|
-
tables = []
|
37
|
-
response['tables'].each do |hash|
|
38
|
-
tables << SkyDB::Table.new(hash['name'])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/skydb/message/lookup.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
class SkyDB
|
2
|
-
class Message
|
3
|
-
class Lookup < SkyDB::Message
|
4
|
-
########################################################################
|
5
|
-
#
|
6
|
-
# Constructor
|
7
|
-
#
|
8
|
-
########################################################################
|
9
|
-
|
10
|
-
# Initializes the 'lookup' message.
|
11
|
-
def initialize(options={})
|
12
|
-
super('lookup')
|
13
|
-
self.actions = options[:actions] || []
|
14
|
-
self.properties = options[:properties] || []
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
##########################################################################
|
19
|
-
#
|
20
|
-
# Attributes
|
21
|
-
#
|
22
|
-
##########################################################################
|
23
|
-
|
24
|
-
##################################
|
25
|
-
# Actions
|
26
|
-
##################################
|
27
|
-
|
28
|
-
# A list of actions to lookup.
|
29
|
-
attr_accessor :actions
|
30
|
-
|
31
|
-
# A list of properties to lookup.
|
32
|
-
attr_accessor :properties
|
33
|
-
|
34
|
-
|
35
|
-
##########################################################################
|
36
|
-
#
|
37
|
-
# Methods
|
38
|
-
#
|
39
|
-
##########################################################################
|
40
|
-
|
41
|
-
####################################
|
42
|
-
# Encoding
|
43
|
-
####################################
|
44
|
-
|
45
|
-
# Encodes the message body.
|
46
|
-
#
|
47
|
-
# @param [IO] buffer the buffer to write the header to.
|
48
|
-
def encode_body(buffer)
|
49
|
-
buffer << {
|
50
|
-
'actionNames' => actions.map {|action| action.name},
|
51
|
-
'propertyNames' => properties.map {|property| property.name}
|
52
|
-
}.to_msgpack
|
53
|
-
end
|
54
|
-
|
55
|
-
####################################
|
56
|
-
# Response processing
|
57
|
-
####################################
|
58
|
-
|
59
|
-
# Updates the action and property identifiers from the returned data.
|
60
|
-
def process_response(response)
|
61
|
-
# Update actions.
|
62
|
-
actions.each_with_index do |action, index|
|
63
|
-
obj = response['actions'][index]
|
64
|
-
action.id = obj.nil? ? 0 : obj['id']
|
65
|
-
end
|
66
|
-
|
67
|
-
# Update properties.
|
68
|
-
properties.each_with_index do |property, index|
|
69
|
-
obj = response['properties'][index]
|
70
|
-
property.id = obj.nil? ? 0 : obj['id']
|
71
|
-
property.type = obj.nil? ? :object : SkyDB::Property::Type.decode(obj['type'])
|
72
|
-
property.data_type = obj.nil? ? nil : obj['dataType']
|
73
|
-
end
|
74
|
-
|
75
|
-
return response
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|