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 +4 -4
- data/librb/engine.rb +21 -3
- data/src/rules/events.c +1 -1
- data/src/rules/json.c +3 -2
- data/src/rules/net.c +4 -2
- data/src/rules/state.c +2 -2
- data/src/rules/state.h +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56d810027b258d2443a8a637b1c58ac7a61cd63f
|
4
|
+
data.tar.gz: 7c6779331a8090a952d942c7120d7d93a3e08e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =>
|
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
|
-
|
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
|
-
|
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
|
-
"
|
1183
|
-
"
|
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) *
|
231
|
+
sprintf_s(jo->idBuffer, sizeof(char) * ID_BUFFER_LENGTH, "$%020llu", hash);
|
232
232
|
#else
|
233
|
-
snprintf(jo->idBuffer, sizeof(char) *
|
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
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.
|
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-
|
11
|
+
date: 2017-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|