Skip to main content

Demo.Util.CleanupSet

class Demo.Util.CleanupSet extends %Library.RegisteredObject

The methods in this class are intended as an example for remediation of situations where your message classes do not have appropriate delete triggers to clean up after themselves. Their operation depends on how your class definitions are constructed. They are not able to purge every conceivable class structure.

Method Inventory

Methods

classmethod GetBodiesCleanupSet(Output pSet, pIncludeProps As %Boolean = 1, pTopKillHdr As %Integer = "", pUseIdRange As %Boolean = 0) as %Status
Caution: this method is intended only for remediation of situations where your message classes do not have appropriate delete triggers to clean up after themselves. Its operation depends on your class definitions and is not able to purge every conceivable class structure. It is up to you to examine and test the operation of this method to verify that it is useful in your environment. Return an array of all persistent or stream classes used as message bodies. If pIncludeProps=1, include persistent or stream classes referred to as property or collection types in any of the body classes, or in any of their properties' properties, etc. Also note that no cleanup at all is possible if the message body class has a custom IDKEY because we can't depend on these to be allocated sequentially.
classmethod GetClassCleanupSet(Output pSet, pClass As %String, pTopKillId=0, pUseIdRange As %Boolean = 0) as %Status
Caution: this method is intended only for remediation of situations where your message classes do not have appropriate delete triggers to clean up after themselves. Its operation depends on your class definitions and is not able to purge every conceivable class structure. It is up to you to examine and test the operation of this method to verify that it is useful in your environment. Return an array of all persistent or stream classes referred to as property or collection types in the given body classes, or in any of its properties' properties, etc. If pUseIdRange is true, also annotate the array with the top ID to be killed for each class. If this ID is not supplied, this method will record the highest ID of the given class not referred to by any header. Also note that no cleanup at all is possible if the message body class has a custom IDKEY because we can't depend on these to be allocated sequentially. pClass may be a single classname, a comma separated list of classnames, or an array of classnames indexed either by ordinal or by name. pTopKillId is a corresponding structure containing the highest ID to be killed / purged for each class. If pClass is an array indexed by classname, this ID may be supplied instead as the node value in pClass.
classmethod GetDeepPurgeSet(Output pSet, pDaysToKeep As %Integer = 7, pUseIdRange As %Boolean = 0) as %Status
Caution: this method is intended only for remediation of situations where your message classes do not have appropriate delete triggers to clean up after themselves. Its operation depends on your class definitions and is not able to purge every conceivable class structure. It is up to you to examine and test the operation of this method to verify that it is useful in your environment. Return an array of all persistent or stream classes referred to as property or collection types in any of the body classes identified to be purged in the date range given by pDaysToKeep, or in any of their properties' properties, etc. Also include message headers and identify the range of message ids to be deleted for each class based on pDaysToKeep.
classmethod PurgeCleanupSet(ByRef pSet, Output pDeletedCount As %Integer, pKeepIntegrity As %Boolean = 0, pUseIdRange As %Boolean = 0) as %Status
Caution: this method is intended only for remediation of situations where your message classes do not have appropriate delete triggers to clean up after themselves. Its operation depends on your class definitions and is not able to purge every conceivable class structure. It is up to you to examine and test the operation of this method to verify that it is useful in your environment. This method's operation is guided by 'cleanup set' array. The methods GetDeepPurgeSet(), GetBodiesCleanupSet(), and GetClassCleanupSet() each represent a different way of constructing such a 'cleanup set'. NB! After using one of those methods to construct a 'cleanup set', you or your code should examine it to remove any entries for classes that should not be purged. For example if a message refers to a permanent patient record, you should remove the patient record class from the 'cleanup set' array before invoking this method. Otherwise it will delete any patient records referred to by messages being purged. Removes all persistent object instances of classes used as message bodies that have IDs lower than the first one used as a message body. This can clean up bodies that were 'orphaned' by purging headers without the 'BodiesToo' option. It also removes persistent objects referred to as property or collection types in any of the classes being cleaned, or in any of their properties' properties. Note that pKeepIntegrity is ignored for a cleanup set produced by GetBodiesCleanupSet because it does not include headers to purge. If possible it will do bulk deletes of each class in the set. Otherwise it will delete all the properties of each object by recursive descent. Bulk ID Range delete will be used if pUseIdRange=1 and: - pKeepIntegrity is false or MessageHeaders are not included (i.e. GetDeepPurgeSet was not used) - the set has no node set("_hasStream")=1 - the set has no node set("_customIDKEY")=1 - No class node present has a "Top ID to purge" value NB! Bulk ID Range delete only makes sense if all the child property objects in your messages are allocated and stored in sequence with the message headers themselves. This will be nearly true if all message objects are created fresh and then immediately sent as Ensemble message bodies. Bulk ID Range delete might be faster or slower than recursive object property deleting, depending on your class definitions and the indices they define. Also note: no cleanup at all is possible if the message body class is a stream or has a custom IDKEY because we can't depend on these to be ordered sequentially.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab