durable_rules 0.34.02 → 0.34.03
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 +46 -1
- data/src/rules/json.c +9 -0
- data/src/rules/net.c +1373 -1084
- data/src/rules/net.h +4 -0
- data/src/rules/rules.h +3 -0
- data/src/rules/state.c +10 -0
- data/src/rulesrb/rules.c +16 -0
- metadata +2 -2
data/src/rules/net.h
CHANGED
@@ -31,6 +31,7 @@ typedef struct binding {
|
|
31
31
|
functionHash partitionHash;
|
32
32
|
functionHash timersHash;
|
33
33
|
functionHash updateActionHash;
|
34
|
+
functionHash deleteSessionHash;
|
34
35
|
char *sessionHashset;
|
35
36
|
char *factsHashset;
|
36
37
|
char *eventsHashset;
|
@@ -147,6 +148,9 @@ unsigned int getSession(void *rulesBinding,
|
|
147
148
|
char *sid,
|
148
149
|
char **state);
|
149
150
|
|
151
|
+
unsigned int deleteSession(void *rulesBinding,
|
152
|
+
char *sid);
|
153
|
+
|
150
154
|
unsigned int updateAction(void *rulesBinding,
|
151
155
|
char *sid);
|
152
156
|
|
data/src/rules/rules.h
CHANGED
data/src/rules/state.c
CHANGED
@@ -410,3 +410,13 @@ unsigned int getState(void *handle, char *sid, char **state) {
|
|
410
410
|
|
411
411
|
return getSession(rulesBinding, sid, state);
|
412
412
|
}
|
413
|
+
|
414
|
+
unsigned int deleteState(void *handle, char *sid) {
|
415
|
+
void *rulesBinding = NULL;
|
416
|
+
unsigned int result = resolveBinding(handle, sid, &rulesBinding);
|
417
|
+
if (result != RULES_OK) {
|
418
|
+
return result;
|
419
|
+
}
|
420
|
+
|
421
|
+
return deleteSession(rulesBinding, sid);
|
422
|
+
}
|
data/src/rulesrb/rules.c
CHANGED
@@ -714,6 +714,21 @@ static VALUE rbGetState(VALUE self, VALUE handle, VALUE sid) {
|
|
714
714
|
return output;
|
715
715
|
}
|
716
716
|
|
717
|
+
static VALUE rbDeleteState(VALUE self, VALUE handle, VALUE sid) {
|
718
|
+
Check_Type(handle, T_FIXNUM);
|
719
|
+
Check_Type(sid, T_STRING);
|
720
|
+
|
721
|
+
unsigned int result = deleteState((void *)FIX2LONG(handle), RSTRING_PTR(sid));
|
722
|
+
if (result != RULES_OK) {
|
723
|
+
if (result == ERR_OUT_OF_MEMORY) {
|
724
|
+
rb_raise(rb_eNoMemError, "Out of memory");
|
725
|
+
} else {
|
726
|
+
rb_raise(rb_eException, "Could not delete state, error code: %d", result);
|
727
|
+
}
|
728
|
+
}
|
729
|
+
|
730
|
+
return Qnil;
|
731
|
+
}
|
717
732
|
|
718
733
|
static VALUE rbRenewActionLease(VALUE self, VALUE handle, VALUE sid) {
|
719
734
|
Check_Type(handle, T_FIXNUM);
|
@@ -765,6 +780,7 @@ void Init_rules() {
|
|
765
780
|
rb_define_singleton_method(rulesModule, "cancel_timer", rbCancelTimer, 3);
|
766
781
|
rb_define_singleton_method(rulesModule, "assert_timers", rbAssertTimers, 1);
|
767
782
|
rb_define_singleton_method(rulesModule, "get_state", rbGetState, 2);
|
783
|
+
rb_define_singleton_method(rulesModule, "delete_state", rbDeleteState, 2);
|
768
784
|
rb_define_singleton_method(rulesModule, "renew_action_lease", rbRenewActionLease, 2);
|
769
785
|
}
|
770
786
|
|
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.03
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesus Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|