durable_rules 2.0.18 → 2.0.19
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.
- checksums.yaml +4 -4
- data/src/rules/events.c +90 -73
- data/src/rules/rete.c +1 -2
- data/src/rules/rete.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: 4f68e8be526e46e47b904f1b0a0af0c00ffa58f5
|
4
|
+
data.tar.gz: 31f9916994a145c2c27b891ce93f9d7795b5c22b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efd950c601e441e71505e9c43935f112b1a223495d487fff180738356ad3c79431a1aa316df59663d13178c5f6e4aaf46f7e0ab4d7cc6f41c9d1c8a8a1855815
|
7
|
+
data.tar.gz: cdb9502e03383280a6ee9ef39ea105f5cd75ae1050744f5b0111ab73144a08e56dc79fdb094046013b9be2f4c16c4cbcf75a838afc7f75b6cc16fe571d15afbc
|
data/src/rules/events.c
CHANGED
@@ -474,7 +474,7 @@ static unsigned int reduceExpression(ruleset *tree,
|
|
474
474
|
jsonObject *leftMessageObject,
|
475
475
|
jsonObject *rightMessageObject,
|
476
476
|
leftFrameNode *context,
|
477
|
-
jsonProperty *targetProperty) {
|
477
|
+
jsonProperty *targetProperty) {
|
478
478
|
jsonProperty leftValue;
|
479
479
|
jsonProperty *leftProperty = &leftValue;
|
480
480
|
CHECK_RESULT(reduceOperand(tree,
|
@@ -505,10 +505,12 @@ static unsigned int reduceExpression(ruleset *tree,
|
|
505
505
|
context,
|
506
506
|
&rightProperty));
|
507
507
|
|
508
|
-
|
508
|
+
unsigned int result = reduceProperties(currentExpression->operator,
|
509
509
|
leftProperty,
|
510
510
|
rightProperty,
|
511
511
|
targetProperty);
|
512
|
+
|
513
|
+
return result;
|
512
514
|
}
|
513
515
|
|
514
516
|
static unsigned int reduceExpressionSequence(ruleset *tree,
|
@@ -527,56 +529,40 @@ static unsigned int reduceExpressionSequence(ruleset *tree,
|
|
527
529
|
return RULES_OK;
|
528
530
|
}
|
529
531
|
|
530
|
-
if (
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
}
|
541
|
-
|
542
|
-
++*i;
|
543
|
-
CHECK_RESULT(reduceExpressionSequence(tree,
|
544
|
-
state,
|
545
|
-
exprs,
|
546
|
-
currentExpression->operator,
|
547
|
-
messageObject,
|
548
|
-
context,
|
549
|
-
i,
|
550
|
-
&dummyProperty));
|
551
|
-
}
|
532
|
+
if (currentExpression->operator == OP_AND || currentExpression->operator == OP_OR) {
|
533
|
+
++*i;
|
534
|
+
CHECK_RESULT(reduceExpressionSequence(tree,
|
535
|
+
state,
|
536
|
+
exprs,
|
537
|
+
currentExpression->operator,
|
538
|
+
messageObject,
|
539
|
+
context,
|
540
|
+
i,
|
541
|
+
targetProperty));
|
552
542
|
} else {
|
553
|
-
|
543
|
+
CHECK_RESULT(reduceExpression(tree,
|
544
|
+
state,
|
545
|
+
currentExpression,
|
546
|
+
messageObject,
|
547
|
+
messageObject,
|
548
|
+
context,
|
549
|
+
targetProperty));
|
550
|
+
++*i;
|
551
|
+
}
|
552
|
+
|
553
|
+
if (targetProperty->type != JSON_BOOL) {
|
554
|
+
return ERR_OPERATION_NOT_SUPPORTED;
|
555
|
+
}
|
556
|
+
|
557
|
+
|
558
|
+
if ((operator == OP_AND && !targetProperty->value.b) ||
|
559
|
+
(operator == OP_OR && targetProperty->value.b)) {
|
560
|
+
while (currentExpression->operator != OP_END) {
|
554
561
|
++*i;
|
555
|
-
|
556
|
-
state,
|
557
|
-
exprs,
|
558
|
-
currentExpression->operator,
|
559
|
-
messageObject,
|
560
|
-
context,
|
561
|
-
i,
|
562
|
-
targetProperty));
|
563
|
-
} else if (currentExpression->operator == OP_IALL || currentExpression->operator == OP_IANY) {
|
564
|
-
|
565
|
-
} else {
|
566
|
-
CHECK_RESULT(reduceExpression(tree,
|
567
|
-
state,
|
568
|
-
currentExpression,
|
569
|
-
messageObject,
|
570
|
-
messageObject,
|
571
|
-
context,
|
572
|
-
targetProperty));
|
573
|
-
if (targetProperty->type != JSON_BOOL) {
|
574
|
-
return ERR_OPERATION_NOT_SUPPORTED;
|
575
|
-
}
|
562
|
+
currentExpression = &exprs->expressions[*i];
|
576
563
|
}
|
564
|
+
return RULES_OK;
|
577
565
|
}
|
578
|
-
|
579
|
-
++*i;
|
580
566
|
}
|
581
567
|
|
582
568
|
return RULES_OK;
|
@@ -665,27 +651,32 @@ static unsigned int getFrameHash(ruleset *tree,
|
|
665
651
|
context,
|
666
652
|
hash);
|
667
653
|
}
|
668
|
-
} else if (exprs->length > 0) {
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
654
|
+
} else if (exprs->length > 0 && exprs->expressions[0].operator == OP_AND) {
|
655
|
+
|
656
|
+
unsigned int result;
|
657
|
+
unsigned int i = 1;
|
658
|
+
while (exprs->expressions[i].operator != OP_OR && exprs->expressions[i].operator != OP_END) {
|
659
|
+
if (i == 1) {
|
660
|
+
*hash = FNV_32_OFFSET_BASIS;
|
661
|
+
}
|
662
|
+
|
663
|
+
if (exprs->expressions[i].operator == OP_EQ) {
|
664
|
+
unsigned int newHash;
|
665
|
+
result = getFrameHashForExpression(tree,
|
666
|
+
state,
|
667
|
+
&exprs->expressions[i],
|
668
|
+
messageObject,
|
669
|
+
context,
|
670
|
+
&newHash);
|
671
|
+
if (result == RULES_OK) {
|
672
|
+
*hash ^= newHash;
|
673
|
+
*hash *= FNV_32_PRIME;
|
686
674
|
}
|
687
675
|
}
|
676
|
+
|
677
|
+
++i;
|
688
678
|
}
|
679
|
+
|
689
680
|
}
|
690
681
|
|
691
682
|
return RULES_OK;
|
@@ -1381,21 +1372,47 @@ static unsigned int handleBetaMessage(ruleset *tree,
|
|
1381
1372
|
sideEffect);
|
1382
1373
|
}
|
1383
1374
|
|
1375
|
+
unsigned int messageHash;
|
1376
|
+
CHECK_RESULT(getFrameHash(tree,
|
1377
|
+
state,
|
1378
|
+
&betaNode->value.b,
|
1379
|
+
messageObject,
|
1380
|
+
NULL,
|
1381
|
+
&messageHash));
|
1382
|
+
|
1384
1383
|
frameLocation rightFrameLocation;
|
1385
1384
|
rightFrameNode *rightFrame;
|
1386
1385
|
|
1386
|
+
CHECK_RESULT(getLastRightFrame(state,
|
1387
|
+
betaNode->value.b.index,
|
1388
|
+
messageHash,
|
1389
|
+
&rightFrame));
|
1390
|
+
|
1391
|
+
while (rightFrame) {
|
1392
|
+
if (rightFrame->messageOffset == currentMessageOffset) {
|
1393
|
+
return RULES_OK;
|
1394
|
+
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
unsigned int rightFrameOffset = rightFrame->prevOffset;
|
1398
|
+
rightFrame = NULL;
|
1399
|
+
while (rightFrameOffset != UNDEFINED_HASH_OFFSET && !rightFrame) {
|
1400
|
+
rightFrame = RIGHT_FRAME_NODE(state,
|
1401
|
+
betaNode->value.b.index,
|
1402
|
+
rightFrameOffset);
|
1403
|
+
if (rightFrame->hash != messageHash) {
|
1404
|
+
rightFrameOffset = rightFrame->prevOffset;
|
1405
|
+
rightFrame = NULL;
|
1406
|
+
}
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
|
1387
1410
|
CHECK_RESULT(createRightFrame(state,
|
1388
1411
|
betaNode,
|
1389
1412
|
&rightFrame,
|
1390
1413
|
&rightFrameLocation));
|
1391
1414
|
|
1392
|
-
|
1393
|
-
CHECK_RESULT(getFrameHash(tree,
|
1394
|
-
state,
|
1395
|
-
&betaNode->value.b,
|
1396
|
-
messageObject,
|
1397
|
-
NULL,
|
1398
|
-
&messageHash));
|
1415
|
+
|
1399
1416
|
|
1400
1417
|
rightFrame->messageOffset = currentMessageOffset;
|
1401
1418
|
CHECK_RESULT(addFrameLocation(state,
|
data/src/rules/rete.c
CHANGED
@@ -348,7 +348,6 @@ static unsigned char compareValue(ruleset *tree,
|
|
348
348
|
char *last,
|
349
349
|
identifier *id,
|
350
350
|
unsigned char type) {
|
351
|
-
|
352
351
|
if (right->type != type) {
|
353
352
|
return 0;
|
354
353
|
}
|
@@ -1009,6 +1008,7 @@ static unsigned int findAlpha(ruleset *tree,
|
|
1009
1008
|
}
|
1010
1009
|
}
|
1011
1010
|
}
|
1011
|
+
|
1012
1012
|
}
|
1013
1013
|
}
|
1014
1014
|
|
@@ -1251,7 +1251,6 @@ static unsigned int createAlpha(ruleset *tree,
|
|
1251
1251
|
0,
|
1252
1252
|
single_offset,
|
1253
1253
|
*newOffset));
|
1254
|
-
|
1255
1254
|
|
1256
1255
|
result = readNextArrayValue(last,
|
1257
1256
|
&first,
|
data/src/rules/rete.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: 2.0.
|
4
|
+
version: 2.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesus Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|