workmesh 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/workmesh.rb +31 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 255b5cf5609d4a94c1a6ddeb7ae7a0cdcc448999c25f7d86e0714d4882ae66dc
|
4
|
+
data.tar.gz: ab3bd85f5e3b7c8944c5680a79d3d07be5256b3ce5d36a86abdfe2413d86443c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fd0f3ecac7a857015e3d26670e43e76344ba57569137b198782af8810450d89c214824c0e0f5c7c7548abaaf3753a6ccfef3105edc23888a62f84d34178c73a
|
7
|
+
data.tar.gz: e255c8ce3f9bb80090589f29f551bc509ab50e30a4624f9d258ff046c9f5ea626bd109491dfd4f2f6b093deacadfc5d8857dade51f7e86cc2eac614c0c43203c
|
data/lib/workmesh.rb
CHANGED
@@ -82,7 +82,7 @@ module BlackStack
|
|
82
82
|
attr_accessor :entity_table, :entity_field_id, :entity_field_sort
|
83
83
|
attr_accessor :push_function, :entity_field_push_time, :entity_field_push_success, :entity_field_push_error_description
|
84
84
|
attr_accessor :pull_status_access_point
|
85
|
-
attr_accessor :pull_function
|
85
|
+
attr_accessor :pull_function #, :enttity_field_pull_time, :entity_field_pull_success, :entity_field_pull_error_description
|
86
86
|
|
87
87
|
def self.descriptor_errors(h)
|
88
88
|
errors = []
|
@@ -109,14 +109,14 @@ module BlackStack
|
|
109
109
|
errors << "The key :entity_field_push_error_description is missing" if h[:push_function] && h[:entity_field_push_error_description].nil?
|
110
110
|
|
111
111
|
# valiudate: if :pull_function exists, the key :pull_status_access_point exists and it is a string
|
112
|
-
errors << "The key :pull_status_access_point is missing" if h[:pull_function] && h[:pull_status_access_point].nil?
|
113
|
-
errors << "The key :pull_status_access_point must be an String" unless h[:pull_function].nil? || h[:pull_status_access_point].is_a?(String)
|
112
|
+
#errors << "The key :pull_status_access_point is missing" if h[:pull_function] && h[:pull_status_access_point].nil?
|
113
|
+
#errors << "The key :pull_status_access_point must be an String" unless h[:pull_function].nil? || h[:pull_status_access_point].is_a?(String)
|
114
114
|
# validate: if :pull_function exists, the key :entity_field_pull_time exists and it is a symbol
|
115
|
-
errors << "The key :entity_field_pull_time is missing" if h[:pull_function] && h[:entity_field_pull_time].nil?
|
115
|
+
#errors << "The key :entity_field_pull_time is missing" if h[:pull_function] && h[:entity_field_pull_time].nil?
|
116
116
|
# validate: if :pull_function exists, the key :entity_field_pull_success exists and it is a symbol
|
117
|
-
errors << "The key :entity_field_pull_success is missing" if h[:pull_function] && h[:entity_field_pull_success].nil?
|
117
|
+
#errors << "The key :entity_field_pull_success is missing" if h[:pull_function] && h[:entity_field_pull_success].nil?
|
118
118
|
# validate: if :pull_function exists, the key :entity_field_pull_error_description exists and it is a symbol
|
119
|
-
errors << "The key :entity_field_pull_error_description is missing" if h[:pull_function] && h[:entity_field_pull_error_description].nil?
|
119
|
+
#errors << "The key :entity_field_pull_error_description is missing" if h[:pull_function] && h[:entity_field_pull_error_description].nil?
|
120
120
|
|
121
121
|
# return list of errors
|
122
122
|
errors.uniq
|
@@ -134,9 +134,9 @@ module BlackStack
|
|
134
134
|
self.entity_field_push_success = h[:entity_field_push_success]
|
135
135
|
self.entity_field_push_error_description = h[:entity_field_push_error_description]
|
136
136
|
self.pull_function = h[:pull_function]
|
137
|
-
self.enttity_field_pull_time = h[:entity_field_pull_time]
|
138
|
-
self.entity_field_pull_success = h[:entity_field_pull_success]
|
139
|
-
self.entity_field_pull_error_description = h[:entity_field_pull_error_description]
|
137
|
+
#self.enttity_field_pull_time = h[:entity_field_pull_time]
|
138
|
+
#self.entity_field_pull_success = h[:entity_field_pull_success]
|
139
|
+
#self.entity_field_pull_error_description = h[:entity_field_pull_error_description]
|
140
140
|
end
|
141
141
|
|
142
142
|
def to_hash()
|
@@ -150,18 +150,19 @@ module BlackStack
|
|
150
150
|
ret[:entity_field_push_success] = self.entity_field_push_success
|
151
151
|
ret[:entity_field_push_error_description] = self.entity_field_push_error_description
|
152
152
|
ret[:pull_function] = self.pull_function
|
153
|
-
ret[:enttity_field_pull_time] = self.enttity_field_pull_time
|
154
|
-
ret[:entity_field_pull_success] = self.entity_field_pull_success
|
155
|
-
ret[:entity_field_pull_error_description] = self.entity_field_pull_error_description
|
153
|
+
#ret[:enttity_field_pull_time] = self.enttity_field_pull_time
|
154
|
+
#ret[:entity_field_pull_success] = self.entity_field_pull_success
|
155
|
+
#ret[:entity_field_pull_error_description] = self.entity_field_pull_error_description
|
156
156
|
ret
|
157
157
|
end
|
158
158
|
|
159
159
|
# execute the push function of this protocol, and update the push flags
|
160
|
-
def push(entity, node)
|
160
|
+
def push(entity, node, l=nil)
|
161
|
+
l = BlackStack::DummyLogger.new(nil) if l.nil?
|
161
162
|
raise 'The push function is not defined' if self.push_function.nil?
|
162
163
|
entity[entity_field_push_time] = now()
|
163
164
|
begin
|
164
|
-
self.push_function.call(entity, node)
|
165
|
+
self.push_function.call(entity, node, l)
|
165
166
|
entity[entity_field_push_success] = true
|
166
167
|
entity[entity_field_push_error_description] = nil
|
167
168
|
entity.save
|
@@ -171,7 +172,19 @@ module BlackStack
|
|
171
172
|
entity.save
|
172
173
|
raise e
|
173
174
|
end
|
174
|
-
end
|
175
|
+
end # def push(entity, node, l=nil)
|
176
|
+
|
177
|
+
# execute the pull function of this protocol, and update the push flags
|
178
|
+
def pull(node, l=nil)
|
179
|
+
l = BlackStack::DummyLogger.new(nil) if l.nil?
|
180
|
+
raise 'The pull function is not defined' if self.pull_function.nil?
|
181
|
+
begin
|
182
|
+
self.pull_function.call(node, l)
|
183
|
+
rescue => e
|
184
|
+
raise e
|
185
|
+
end
|
186
|
+
end # def pull(node, l=nil)
|
187
|
+
|
175
188
|
end # class Protocol
|
176
189
|
|
177
190
|
# stub worker class
|
@@ -196,8 +209,8 @@ module BlackStack
|
|
196
209
|
if h[:protocols].is_a?(Array)
|
197
210
|
h[:protocols].each do |protocol|
|
198
211
|
errors << "The key :protocols must be an Array of valid hash descritors of the Protocol class" unless protocol.is_a?(Hash)
|
199
|
-
|
200
|
-
errors << "The key :protocols must be an Array of valid hash descritors of the Protocol class
|
212
|
+
z = Protocol.descriptor_errors(protocol)
|
213
|
+
errors << "The key :protocols must be an Array of valid hash descritors of the Protocol class (errors: #{z.join('. ')})" unless z.length == 0
|
201
214
|
end
|
202
215
|
end
|
203
216
|
# validate: the key :assignation is nil or it is a symbol belonging the array ASSIGANTIONS
|
@@ -211,7 +224,7 @@ module BlackStack
|
|
211
224
|
# setup dispatcher configuration here
|
212
225
|
def initialize(h)
|
213
226
|
errors = BlackStack::Workmesh::Service.descriptor_errors(h)
|
214
|
-
raise "The
|
227
|
+
raise "The service descriptor is not valid: #{errors.uniq.join(".\n")}" if errors.length > 0
|
215
228
|
self.name = h[:name]
|
216
229
|
self.entity_table = h[:entity_table]
|
217
230
|
self.entity_field_assignation = h[:entity_field_assignation]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workmesh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|