Open b1conrad opened 2 years ago
This would actually also address issue #511 because the subscription ruleset already does the needful by selecting on the wrangler:rulesets_need_to_cleanup
event!
Note that rulesets selecting on the wrangler:rulesets_need_to_cleanup
event MUST complete anything needed within the confines of the existing schedule. Oh, which means the suggestion won't work. Sigh.
It also was wrong because it was running in the parent pico, not the pico that was about to be deleted!
How about this?
rule deleteOneChild {
select when wrangler child_deletion_request
eci re#^(.+)$#
every {
event:send({"eci":eci,"domain":"wrangler","type":"rulesets_need_to_cleanup"})
event:send({"eci":eci,"domain":"wrangler","type":"ready_for_deletion"})
}
}
along with modifying the child_initiates_deletion
rule to send its parent the wrangler:internal_pico_deletion
event, and NOT the wrangler:child_deletion_request
else we'd have an infinite loop of events and nothing would ever get deleted!
The idea is, you as a KRL developer do one of two things:
wrangler:ready_for_deletion
eventwrangler:child_deletion_request
and select on wrangler:rulesets_need_to_cleanup
Either way, the cleanup is done in the child pico before it is actually deleted.
Here is a ruleset taking care of this: https://github.com/Picolab/fully-sharded-database/blob/main/krl/byu.hr.oit.krl#L454-L455
Suggest giving this some thought and then incorporating it into Wrangler.
This would best be done by raising an event, say
wrangler:rulesets_need_to_cleanup
, and only then doing the actual deletion.Suggestion (that won't work (see below)): that the existing rule
be replaced by two rules