durable_rules 0.34.36 → 0.34.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47e6483313e3fe7047cb09fea58da4f5bf3c0c25
4
- data.tar.gz: fcc1f99df7b9cb4b932af7bb9eb749265c82dfa4
3
+ metadata.gz: 56d810027b258d2443a8a637b1c58ac7a61cd63f
4
+ data.tar.gz: 7c6779331a8090a952d942c7120d7d93a3e08e23
5
5
  SHA512:
6
- metadata.gz: 32bbe82822555390ca0a164945fb9a1ec6017f14a8f492e2fe5b9e1d6830ae7bc6a5c31e0b9e47017839c9f85cea0b6201875d9c43363acc4e9e845598243783
7
- data.tar.gz: 1214ab05cdd4ebc38344378394fb7f4cb979b9921a8975701c4389aefc0f6df3d8a7c4b89ef2bbe6e6b3f4909426f2b53c06d10951c1abc8f63fb7a770a5a994
6
+ metadata.gz: aeb2094be7c3a54626e973919693491fa007004ea2e3199ff45ced2100918b47df7ff8d9007b4f71f330dbbd83d01c152a151b56b7b411ca16147061f35d967c
7
+ data.tar.gz: c5e54f6bf1e9b99fed474f72c2bd2bf0ac6f544780d55f21dcc3bb45ad576b61ec66ddba4dbc81002988e5d724ef4f4691fc38c02e70564d5013a0ecde435950
data/librb/engine.rb CHANGED
@@ -435,7 +435,6 @@ module Engine
435
435
  end
436
436
  end
437
437
 
438
- puts JSON.generate(ruleset_definition)
439
438
  @handle = Rules.create_ruleset name, JSON.generate(ruleset_definition), state_cache_size
440
439
  @definition = ruleset_definition
441
440
  end
@@ -1321,7 +1320,7 @@ module Engine
1321
1320
 
1322
1321
  class Queue
1323
1322
 
1324
- def initialize(ruleset_name, database = {:host => 'localhost', :port => 6379, :password => nil, :db => 0}, state_cache_size = 1024)
1323
+ def initialize(ruleset_name, database = {:host => "localhost", :port => 6379, :password => nil, :db => 0}, state_cache_size = 1024)
1325
1324
  @_ruleset_name = ruleset_name.to_s
1326
1325
  @handle = Rules.create_client @_ruleset_name, state_cache_size
1327
1326
  if database.kind_of? String
@@ -1331,23 +1330,42 @@ module Engine
1331
1330
  end
1332
1331
  end
1333
1332
 
1333
+ def isClosed()
1334
+ @handle == 0
1335
+ end
1336
+
1334
1337
  def post(message)
1338
+ if @handle == 0
1339
+ raise "Queue has already been closed"
1340
+ end
1341
+
1335
1342
  sid = (message.key? :sid) ? message[:sid]: message['sid']
1336
1343
  Rules.queue_assert_event @handle, sid.to_s, @_ruleset_name, JSON.generate(message)
1337
1344
  end
1338
1345
 
1339
1346
  def assert(message)
1347
+ if @handle == 0
1348
+ raise "Queue has already been closed"
1349
+ end
1350
+
1340
1351
  sid = (message.key? :sid) ? message[:sid]: message['sid']
1341
1352
  Rules.queue_assert_fact @handle, sid.to_s, @_ruleset_name, JSON.generate(message)
1342
1353
  end
1343
1354
 
1344
1355
  def retract(message)
1356
+ if @handle == 0
1357
+ raise "Queue has already been closed"
1358
+ end
1359
+
1345
1360
  sid = (message.key? :sid) ? message[:sid]: message['sid']
1346
1361
  Rules.queue_retract_fact @handle, sid.to_s, @_ruleset_name, JSON.generate(message)
1347
1362
  end
1348
1363
 
1349
1364
  def close()
1350
- Rules.delete_client @handle
1365
+ if @handle != 0
1366
+ Rules.delete_client @handle
1367
+ @handle = 0
1368
+ end
1351
1369
  end
1352
1370
  end
1353
1371
 
data/src/rules/events.c CHANGED
@@ -1049,7 +1049,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1049
1049
  }
1050
1050
  }
1051
1051
 
1052
- if(currentAlpha->betaListOffset && currentAlpha != arrayAlpha) {
1052
+ if ((currentAlpha->betaListOffset || !currentAlpha->nextOffset) && currentAlpha != arrayAlpha) {
1053
1053
  *propertyMatch = 1;
1054
1054
  break;
1055
1055
  }
data/src/rules/json.c CHANGED
@@ -403,8 +403,9 @@ static unsigned int getStringAndHash(char *start, char **first, char **last, uns
403
403
  state = ST_STRING_PARSE;
404
404
  delimiter = start[0];
405
405
  *first = start + 1;
406
- }
407
- else if (!IS_WHITESPACE(start[0])) {
406
+ } else if (start[0] == '}') {
407
+ return PARSE_END;
408
+ } else if (!IS_WHITESPACE(start[0])) {
408
409
  return ERR_PARSE_STRING;
409
410
  }
410
411
  break;
data/src/rules/net.c CHANGED
@@ -1179,8 +1179,10 @@ static unsigned int loadPeekActionCommand(ruleset *tree, binding *rulesBinding)
1179
1179
  " until not next\n"
1180
1180
  " if value == \"$null\" then\n"
1181
1181
  " sub_message[name] = cjson.null\n"
1182
- " else\n"
1183
- " sub_message[name] = value\n"
1182
+ " elseif name ~= \"id\" or type(value) ~= \"string\" or string.sub(value, 1, 1) ~= \"$\" then\n"
1183
+ " if name ~= \"$f\" then \n"
1184
+ " sub_message[name] = value\n"
1185
+ " end\n"
1184
1186
  " end\n"
1185
1187
  " end\n"
1186
1188
  " end\n"
data/src/rules/state.c CHANGED
@@ -228,9 +228,9 @@ static void calculateId(jsonObject *jo) {
228
228
  }
229
229
 
230
230
  #ifdef _WIN32
231
- sprintf_s(jo->idBuffer, sizeof(char) * 21, "%020llu", hash);
231
+ sprintf_s(jo->idBuffer, sizeof(char) * ID_BUFFER_LENGTH, "$%020llu", hash);
232
232
  #else
233
- snprintf(jo->idBuffer, sizeof(char) * 21, "%020llu", hash);
233
+ snprintf(jo->idBuffer, sizeof(char) * ID_BUFFER_LENGTH, "$%020llu", hash);
234
234
  #endif
235
235
  jo->properties[jo->idIndex].valueLength = 20;
236
236
  }
data/src/rules/state.h CHANGED
@@ -4,7 +4,7 @@
4
4
  #define UNDEFINED_INDEX 0xFFFFFFFF
5
5
  #define MAX_NAME_LENGTH 256
6
6
  #define SID_BUFFER_LENGTH 2
7
- #define ID_BUFFER_LENGTH 21
7
+ #define ID_BUFFER_LENGTH 22
8
8
  #define UNDEFINED_HASH_OFFSET 0xFFFFFFFF
9
9
 
10
10
  #define JSON_OBJECT_SEQUENCED 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.36
4
+ version: 0.34.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-19 00:00:00.000000000 Z
11
+ date: 2017-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake