rebat 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rebat/client.rb +10 -4
- data/lib/rebat/selector.rb +1 -1
- data/lib/rebat/thrift/rebat_d_b.rb +53 -0
- data/lib/rebat/version.rb +1 -1
- metadata +4 -4
data/lib/rebat/client.rb
CHANGED
@@ -10,7 +10,7 @@ class Rebat::Client
|
|
10
10
|
@transport.open
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def sendQuery(&block)
|
14
14
|
begin
|
15
15
|
@transport.open unless @transport.open?
|
16
16
|
yield @client
|
@@ -33,7 +33,7 @@ class Rebat::Client
|
|
33
33
|
edge.weight = weight
|
34
34
|
edge.relationId = relations[relation_key]
|
35
35
|
|
36
|
-
self.
|
36
|
+
self.sendQuery do |client|
|
37
37
|
client.addQuery(edge)
|
38
38
|
end
|
39
39
|
end
|
@@ -47,7 +47,7 @@ class Rebat::Client
|
|
47
47
|
edge.toEntityType = to_entity_type
|
48
48
|
edge.relationId = relations[relation_key]
|
49
49
|
|
50
|
-
self.
|
50
|
+
self.sendQuery do |client|
|
51
51
|
client.updateWeightQuery(edge, new_weight)
|
52
52
|
end
|
53
53
|
end
|
@@ -61,7 +61,7 @@ class Rebat::Client
|
|
61
61
|
edge.toEntityType = to_entity_type
|
62
62
|
edge.relationId = relations[relation_key]
|
63
63
|
|
64
|
-
self.
|
64
|
+
self.sendQuery do |client|
|
65
65
|
client.deleteQuery(edge)
|
66
66
|
end
|
67
67
|
end
|
@@ -82,6 +82,12 @@ class Rebat::Client
|
|
82
82
|
Rebat::Selector.new(self).exclude *args
|
83
83
|
end
|
84
84
|
|
85
|
+
def truncate
|
86
|
+
self.sendQuery do |client|
|
87
|
+
client.truncate
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
85
91
|
private
|
86
92
|
attr_reader :transport, :protocol, :client
|
87
93
|
end
|
data/lib/rebat/selector.rb
CHANGED
@@ -73,6 +73,21 @@ require 'rebat_types'
|
|
73
73
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'selectQuery failed: unknown result')
|
74
74
|
end
|
75
75
|
|
76
|
+
def truncate()
|
77
|
+
send_truncate()
|
78
|
+
return recv_truncate()
|
79
|
+
end
|
80
|
+
|
81
|
+
def send_truncate()
|
82
|
+
send_message('truncate', Truncate_args)
|
83
|
+
end
|
84
|
+
|
85
|
+
def recv_truncate()
|
86
|
+
result = receive_message(Truncate_result)
|
87
|
+
return result.success unless result.success.nil?
|
88
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'truncate failed: unknown result')
|
89
|
+
end
|
90
|
+
|
76
91
|
end
|
77
92
|
|
78
93
|
class Processor
|
@@ -106,6 +121,13 @@ require 'rebat_types'
|
|
106
121
|
write_result(result, oprot, 'selectQuery', seqid)
|
107
122
|
end
|
108
123
|
|
124
|
+
def process_truncate(seqid, iprot, oprot)
|
125
|
+
args = read_args(iprot, Truncate_args)
|
126
|
+
result = Truncate_result.new()
|
127
|
+
result.success = @handler.truncate()
|
128
|
+
write_result(result, oprot, 'truncate', seqid)
|
129
|
+
end
|
130
|
+
|
109
131
|
end
|
110
132
|
|
111
133
|
# HELPER FUNCTIONS AND STRUCTURES
|
@@ -240,6 +262,37 @@ require 'rebat_types'
|
|
240
262
|
::Thrift::Struct.generate_accessors self
|
241
263
|
end
|
242
264
|
|
265
|
+
class Truncate_args
|
266
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
267
|
+
|
268
|
+
FIELDS = {
|
269
|
+
|
270
|
+
}
|
271
|
+
|
272
|
+
def struct_fields; FIELDS; end
|
273
|
+
|
274
|
+
def validate
|
275
|
+
end
|
276
|
+
|
277
|
+
::Thrift::Struct.generate_accessors self
|
278
|
+
end
|
279
|
+
|
280
|
+
class Truncate_result
|
281
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
282
|
+
SUCCESS = 0
|
283
|
+
|
284
|
+
FIELDS = {
|
285
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'}
|
286
|
+
}
|
287
|
+
|
288
|
+
def struct_fields; FIELDS; end
|
289
|
+
|
290
|
+
def validate
|
291
|
+
end
|
292
|
+
|
293
|
+
::Thrift::Struct.generate_accessors self
|
294
|
+
end
|
295
|
+
|
243
296
|
end
|
244
297
|
|
245
298
|
end
|
data/lib/rebat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rebat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09
|
13
|
+
date: 2012-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thrift
|
17
|
-
requirement: &
|
17
|
+
requirement: &70100124312720 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 0.8.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70100124312720
|
26
26
|
description: ! 'Rebat DB driver for ruby '
|
27
27
|
email:
|
28
28
|
- omar.mekky@mashsolvents.com
|