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.
Files changed (84) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +165 -1
  3. data/lib/skydb.rb +18 -61
  4. data/lib/skydb/client.rb +186 -186
  5. data/lib/skydb/event.rb +47 -76
  6. data/lib/skydb/property.rb +34 -67
  7. data/lib/skydb/table.rb +121 -41
  8. data/lib/skydb/version.rb +1 -1
  9. data/test/integration/client_test.rb +88 -0
  10. data/test/test_helper.rb +3 -51
  11. data/test/unit/client_test.rb +135 -32
  12. metadata +17 -278
  13. data/bin/sky +0 -89
  14. data/lib/ext/hash.rb +0 -11
  15. data/lib/ext/string.rb +0 -11
  16. data/lib/ext/treetop.rb +0 -19
  17. data/lib/skydb/action.rb +0 -76
  18. data/lib/skydb/import.rb +0 -7
  19. data/lib/skydb/import/importer.rb +0 -435
  20. data/lib/skydb/import/transforms/apache.yml +0 -4
  21. data/lib/skydb/import/transforms/sky.yml +0 -28
  22. data/lib/skydb/import/transforms/snowplow.yml +0 -1
  23. data/lib/skydb/import/translator.rb +0 -119
  24. data/lib/skydb/message.rb +0 -146
  25. data/lib/skydb/message/add_action.rb +0 -53
  26. data/lib/skydb/message/add_event.rb +0 -72
  27. data/lib/skydb/message/add_property.rb +0 -55
  28. data/lib/skydb/message/create_table.rb +0 -64
  29. data/lib/skydb/message/delete_table.rb +0 -66
  30. data/lib/skydb/message/get_action.rb +0 -55
  31. data/lib/skydb/message/get_actions.rb +0 -38
  32. data/lib/skydb/message/get_properties.rb +0 -38
  33. data/lib/skydb/message/get_property.rb +0 -55
  34. data/lib/skydb/message/get_table.rb +0 -74
  35. data/lib/skydb/message/get_tables.rb +0 -43
  36. data/lib/skydb/message/lookup.rb +0 -79
  37. data/lib/skydb/message/lua/aggregate.rb +0 -63
  38. data/lib/skydb/message/multi.rb +0 -57
  39. data/lib/skydb/message/next_actions.rb +0 -55
  40. data/lib/skydb/message/ping.rb +0 -32
  41. data/lib/skydb/property/type.rb +0 -40
  42. data/lib/skydb/query.rb +0 -183
  43. data/lib/skydb/query/after_condition.rb +0 -104
  44. data/lib/skydb/query/ast/selection_field_syntax_node.rb +0 -26
  45. data/lib/skydb/query/ast/selection_fields_syntax_node.rb +0 -16
  46. data/lib/skydb/query/ast/selection_group_syntax_node.rb +0 -16
  47. data/lib/skydb/query/ast/selection_groups_syntax_node.rb +0 -16
  48. data/lib/skydb/query/condition.rb +0 -113
  49. data/lib/skydb/query/on_condition.rb +0 -53
  50. data/lib/skydb/query/selection.rb +0 -398
  51. data/lib/skydb/query/selection_field.rb +0 -99
  52. data/lib/skydb/query/selection_fields_grammar.treetop +0 -46
  53. data/lib/skydb/query/selection_fields_parse_error.rb +0 -30
  54. data/lib/skydb/query/selection_group.rb +0 -78
  55. data/lib/skydb/query/selection_groups_grammar.treetop +0 -31
  56. data/lib/skydb/query/selection_groups_parse_error.rb +0 -30
  57. data/lib/skydb/query/validation_error.rb +0 -8
  58. data/lib/skydb/timestamp.rb +0 -22
  59. data/test/integration/query_test.rb +0 -102
  60. data/test/unit/event_test.rb +0 -32
  61. data/test/unit/import/importer_test.rb +0 -208
  62. data/test/unit/import/translator_test.rb +0 -88
  63. data/test/unit/message/add_action_message_test.rb +0 -34
  64. data/test/unit/message/add_event_message_test.rb +0 -35
  65. data/test/unit/message/add_property_message_test.rb +0 -41
  66. data/test/unit/message/create_table_message_test.rb +0 -34
  67. data/test/unit/message/delete_table_message_test.rb +0 -34
  68. data/test/unit/message/get_action_message_test.rb +0 -34
  69. data/test/unit/message/get_actions_message_test.rb +0 -18
  70. data/test/unit/message/get_properties_message_test.rb +0 -18
  71. data/test/unit/message/get_property_message_test.rb +0 -34
  72. data/test/unit/message/get_table_message_test.rb +0 -19
  73. data/test/unit/message/get_tables_message_test.rb +0 -18
  74. data/test/unit/message/lookup_message_test.rb +0 -27
  75. data/test/unit/message/lua_aggregate_message_test.rb +0 -19
  76. data/test/unit/message/multi_message_test.rb +0 -22
  77. data/test/unit/message/next_action_message_test.rb +0 -34
  78. data/test/unit/message/ping_message_test.rb +0 -18
  79. data/test/unit/message_test.rb +0 -15
  80. data/test/unit/query/after_test.rb +0 -89
  81. data/test/unit/query/on_test.rb +0 -71
  82. data/test/unit/query/selection_test.rb +0 -273
  83. data/test/unit/query_test.rb +0 -182
  84. 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
@@ -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