durable_rules 2.0.13 → 2.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/src/rules/events.c +34 -15
  3. data/src/rules/rete.c +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a59f2931c68ee630804d3977806f55f9fc37fe69
4
- data.tar.gz: b048792c1aea26bdbfbaf988981bec493c2ff131
3
+ metadata.gz: 6b3f86141fd9b53867edf211a1008b807d522d54
4
+ data.tar.gz: 91b6255fae95cd1d9a6648a23dba0d8b72a0fa40
5
5
  SHA512:
6
- metadata.gz: 1500b22b61d1b7617a1339b95b2b602a8543f32bf324f0e22167147a4e5874177bc42005f486fcbf2aeda1bae1cad4fb7927a6949bf9f7256da4968c04d325d3
7
- data.tar.gz: 6b4444694c2bba5f3f9b362e56352f17a69e471c80ad3883d03332dc06fb12113458c7b539847a5c5f50f138d933cff7266d5767a9c6e66f8d5bf3d1fa2c81e0
6
+ metadata.gz: 9219d3e769d17aa93866cfb2ce6e30b4d4c0117637b7c50cd1ff6e424f394d74aeeec5b60f89c53166591c63d7314907951b110a1aa973f2ae787d95054513e6
7
+ data.tar.gz: 316489bd3dfd55dcec01b39a121e9bf9fad2c3d2e5330ba76489095898eae6f5fe96e8d053f00eaa8673c1afb77bffcc0c3b924880893e863f25354c5bd718eb
data/src/rules/events.c CHANGED
@@ -64,7 +64,8 @@ static unsigned int handleMessage(ruleset *tree,
64
64
  static unsigned int reduceExpression(ruleset *tree,
65
65
  stateNode *state,
66
66
  expression *currentExpression,
67
- jsonObject *messageObject,
67
+ jsonObject *leftMessageObject,
68
+ jsonObject *rightMessageObject,
68
69
  leftFrameNode *context,
69
70
  jsonProperty *targetProperty);
70
71
 
@@ -272,6 +273,7 @@ static unsigned int reduceOperand(ruleset *tree,
272
273
  state,
273
274
  currentExpression,
274
275
  messageObject,
276
+ messageObject,
275
277
  context,
276
278
  *targetProperty);
277
279
  }
@@ -467,7 +469,8 @@ static unsigned int reduceProperties(unsigned char operator,
467
469
  static unsigned int reduceExpression(ruleset *tree,
468
470
  stateNode *state,
469
471
  expression *currentExpression,
470
- jsonObject *messageObject,
472
+ jsonObject *leftMessageObject,
473
+ jsonObject *rightMessageObject,
471
474
  leftFrameNode *context,
472
475
  jsonProperty *targetProperty) {
473
476
  jsonProperty leftValue;
@@ -475,7 +478,7 @@ static unsigned int reduceExpression(ruleset *tree,
475
478
  CHECK_RESULT(reduceOperand(tree,
476
479
  state,
477
480
  &currentExpression->left,
478
- messageObject,
481
+ leftMessageObject,
479
482
  context,
480
483
  &leftProperty));
481
484
 
@@ -496,7 +499,7 @@ static unsigned int reduceExpression(ruleset *tree,
496
499
  CHECK_RESULT(reduceOperand(tree,
497
500
  state,
498
501
  &currentExpression->right,
499
- messageObject,
502
+ rightMessageObject,
500
503
  context,
501
504
  &rightProperty));
502
505
 
@@ -562,6 +565,7 @@ static unsigned int reduceExpressionSequence(ruleset *tree,
562
565
  state,
563
566
  currentExpression,
564
567
  messageObject,
568
+ messageObject,
565
569
  context,
566
570
  targetProperty));
567
571
  if (targetProperty->type != JSON_BOOL) {
@@ -714,7 +718,8 @@ static unsigned int isBetaMatch(ruleset *tree,
714
718
 
715
719
  static unsigned int isAlphaMatch(ruleset *tree,
716
720
  alpha *currentAlpha,
717
- jsonObject *messageObject,
721
+ jsonObject *leftMessageObject,
722
+ jsonObject *rightMessageObject,
718
723
  unsigned char *propertyMatch) {
719
724
  *propertyMatch = 0;
720
725
  if (currentAlpha->expression.operator == OP_EX) {
@@ -724,7 +729,8 @@ static unsigned int isAlphaMatch(ruleset *tree,
724
729
  unsigned int result = reduceExpression(tree,
725
730
  NULL,
726
731
  &currentAlpha->expression,
727
- messageObject,
732
+ leftMessageObject,
733
+ rightMessageObject,
728
734
  NULL,
729
735
  &resultProperty);
730
736
 
@@ -1417,13 +1423,15 @@ static unsigned int handleBetaMessage(ruleset *tree,
1417
1423
  }
1418
1424
 
1419
1425
  static unsigned int isArrayMatch(ruleset *tree,
1426
+ jsonObject *currentObject,
1420
1427
  jsonObject *messageObject,
1421
1428
  jsonProperty *currentProperty,
1422
1429
  alpha *arrayAlpha,
1423
1430
  unsigned char *propertyMatch);
1424
1431
 
1425
1432
  static unsigned int isNextMatch(ruleset *tree,
1426
- jsonObject *jo,
1433
+ jsonObject *currentObject,
1434
+ jsonObject *messageObject,
1427
1435
  alpha *currentAlpha,
1428
1436
  unsigned char *propertyMatch) {
1429
1437
  *propertyMatch = 0;
@@ -1432,12 +1440,13 @@ static unsigned int isNextMatch(ruleset *tree,
1432
1440
  for (unsigned int entry = 0; nextList[entry] != 0; ++entry) {
1433
1441
  node *listNode = &tree->nodePool[nextList[entry]];
1434
1442
  jsonProperty *currentProperty;
1435
- unsigned int aresult = getObjectProperty(jo, listNode->value.a.expression.left.value.id.propertyNameHash, &currentProperty);
1443
+ unsigned int aresult = getObjectProperty(currentObject, listNode->value.a.expression.left.value.id.propertyNameHash, &currentProperty);
1436
1444
  if (aresult == ERR_PROPERTY_NOT_FOUND) {
1437
1445
  *propertyMatch = 1;
1438
1446
  if (listNode->value.a.nextOffset || listNode->value.a.nextListOffset) {
1439
1447
  CHECK_RESULT(isNextMatch(tree,
1440
- jo,
1448
+ currentObject,
1449
+ messageObject,
1441
1450
  &listNode->value.a,
1442
1451
  propertyMatch));
1443
1452
  }
@@ -1452,27 +1461,30 @@ static unsigned int isNextMatch(ruleset *tree,
1452
1461
 
1453
1462
  if (currentAlpha->nextOffset) {
1454
1463
  unsigned int *nextHashset = &tree->nextPool[currentAlpha->nextOffset];
1455
- for(unsigned int propertyIndex = 0; propertyIndex < jo->propertiesLength; ++propertyIndex) {
1456
- jsonProperty *currentProperty = &jo->properties[propertyIndex];
1464
+ for(unsigned int propertyIndex = 0; propertyIndex < currentObject->propertiesLength; ++propertyIndex) {
1465
+ jsonProperty *currentProperty = &currentObject->properties[propertyIndex];
1457
1466
  for (unsigned int entry = currentProperty->hash & HASH_MASK; nextHashset[entry] != 0; entry = (entry + 1) % NEXT_BUCKET_LENGTH) {
1458
1467
  node *hashNode = &tree->nodePool[nextHashset[entry]];
1459
1468
  if (currentProperty->hash == hashNode->value.a.expression.left.value.id.propertyNameHash) {
1460
1469
  if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1461
1470
  CHECK_RESULT(isArrayMatch(tree,
1462
- jo,
1471
+ currentObject,
1472
+ messageObject,
1463
1473
  currentProperty,
1464
1474
  &hashNode->value.a,
1465
1475
  propertyMatch));
1466
1476
  } else {
1467
1477
  CHECK_RESULT(isAlphaMatch(tree,
1468
1478
  &hashNode->value.a,
1469
- jo,
1479
+ currentObject,
1480
+ messageObject,
1470
1481
  propertyMatch));
1471
1482
  }
1472
1483
 
1473
1484
  if (*propertyMatch && (hashNode->value.a.nextOffset || hashNode->value.a.nextListOffset)) {
1474
1485
  CHECK_RESULT(isNextMatch(tree,
1475
- jo,
1486
+ currentObject,
1487
+ messageObject,
1476
1488
  &hashNode->value.a,
1477
1489
  propertyMatch));
1478
1490
 
@@ -1490,6 +1502,7 @@ static unsigned int isNextMatch(ruleset *tree,
1490
1502
  }
1491
1503
 
1492
1504
  static unsigned int isArrayMatch(ruleset *tree,
1505
+ jsonObject *currentObject,
1493
1506
  jsonObject *messageObject,
1494
1507
  jsonProperty *currentProperty,
1495
1508
  alpha *arrayAlpha,
@@ -1500,7 +1513,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1500
1513
  return RULES_OK;
1501
1514
  }
1502
1515
 
1503
- char *first = messageObject->content + currentProperty->valueOffset;
1516
+ char *first = currentObject->content + currentProperty->valueOffset;
1504
1517
  char *last;
1505
1518
  unsigned char type;
1506
1519
  jsonObject jo;
@@ -1543,6 +1556,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1543
1556
  if (listNode->value.a.nextOffset || listNode->value.a.nextListOffset) {
1544
1557
  CHECK_RESULT(isNextMatch(tree,
1545
1558
  &jo,
1559
+ messageObject,
1546
1560
  &listNode->value.a,
1547
1561
  propertyMatch));
1548
1562
  }
@@ -1565,6 +1579,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1565
1579
  if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1566
1580
  CHECK_RESULT(isArrayMatch(tree,
1567
1581
  &jo,
1582
+ messageObject,
1568
1583
  currentProperty,
1569
1584
  &hashNode->value.a,
1570
1585
  propertyMatch));
@@ -1572,12 +1587,14 @@ static unsigned int isArrayMatch(ruleset *tree,
1572
1587
  CHECK_RESULT(isAlphaMatch(tree,
1573
1588
  &hashNode->value.a,
1574
1589
  &jo,
1590
+ messageObject,
1575
1591
  propertyMatch));
1576
1592
  }
1577
1593
 
1578
1594
  if (*propertyMatch && (hashNode->value.a.nextOffset || hashNode->value.a.nextListOffset)) {
1579
1595
  CHECK_RESULT(isNextMatch(tree,
1580
1596
  &jo,
1597
+ messageObject,
1581
1598
  &hashNode->value.a,
1582
1599
  propertyMatch));
1583
1600
 
@@ -1662,6 +1679,7 @@ static unsigned int handleAlpha(ruleset *tree,
1662
1679
  unsigned char match = 0;
1663
1680
  if (hashNode->value.a.expression.operator == OP_IALL || hashNode->value.a.expression.operator == OP_IANY) {
1664
1681
  CHECK_RESULT(isArrayMatch(tree,
1682
+ jo,
1665
1683
  jo,
1666
1684
  currentProperty,
1667
1685
  &hashNode->value.a,
@@ -1669,6 +1687,7 @@ static unsigned int handleAlpha(ruleset *tree,
1669
1687
  } else {
1670
1688
  CHECK_RESULT(isAlphaMatch(tree,
1671
1689
  &hashNode->value.a,
1690
+ jo,
1672
1691
  jo,
1673
1692
  &match));
1674
1693
  }
data/src/rules/rete.c CHANGED
@@ -910,7 +910,7 @@ static unsigned int readExpression(ruleset *tree, char *rule, unsigned char *exp
910
910
  &newExpression,
911
911
  expressionOffset));
912
912
 
913
- *expressionType = JSON_EXPRESSION;
913
+ *expressionType = 0;
914
914
  newExpression->operator = operator;
915
915
  CHECK_PARSE_RESULT(readNextValue(last,
916
916
  &first,
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.13
4
+ version: 2.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-02 00:00:00.000000000 Z
11
+ date: 2019-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake