You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simplest potential filter implementation should be done for 1.0. Baha, this one is for you! (*^3^)/~☆
You probably should wait for the package PR (#44) to be rolled in, as you will not have to worry about backwards compatibility/upgrading to the new format.
There are three things that need to be done for filters.
Implement the HalFilter class. This should be in a somewhat similar vain to the HalObject/HalModule/HalAgent classes, but it should not inherit from HalObject, as it does not act as a message sender/receiver, just an intermediary. The init called by __init__ paradigm used in HalObject should be implemented. There should also, and most critically, be an abstract method called filter or something similar that takes in a message, and returns either a processed (or unprocessed) message or None, with None indicating that the message should not be propagated any further.
There needs to be something that associates filters with an module or agent. I was thinking a list of filter class names in the module/agent instance config block that would be assigned to a filters key on the HalObject. This should probably be done in the __init__ method in halobject.py.
Lastly, there needs to be something that filters messages. In halobject.py, the _queue_msg function is called to queue each incoming message to an agent or module. The filtering could be done here (it could also be done on receive, to put it on the receiver's event queue, but it doesn't really make too much of a difference I think). So before queuing the message, the message should be passed to each of the registered filter's filter method, which returns a perhaps different ("preprocessed", perhaps) message or None. If None is returned, the message should be dropped, not passed to any more filters and not queued.
The text was updated successfully, but these errors were encountered:
but it should not inherit from HalObject, as it does not act as a message sender/receiver, just an intermediary.
Is this still relevant? I believe this issue was created before RIs and the rise of message passing. I think the easiest way to implement this without adding too much special case stuff would be to have it subclass HalModule, and instantiate it as a module.
This way, the HalFilter objects simply act as an intermediary module that continues passing (or rejects...) messages without altering the origin. That is, a message sent to a filter by a module continues to have that module as its origin.
The simplest potential filter implementation should be done for 1.0. Baha, this one is for you! (*^3^)/~☆
You probably should wait for the package PR (#44) to be rolled in, as you will not have to worry about backwards compatibility/upgrading to the new format.There are three things that need to be done for filters.
HalFilter
class. This should be in a somewhat similar vain to the HalObject/HalModule/HalAgent classes, but it should not inherit from HalObject, as it does not act as a message sender/receiver, just an intermediary. Theinit
called by__init__
paradigm used inHalObject
should be implemented. There should also, and most critically, be an abstract method calledfilter
or something similar that takes in a message, and returns either a processed (or unprocessed) message orNone
, withNone
indicating that the message should not be propagated any further.filters
key on the HalObject. This should probably be done in the__init__
method inhalobject.py
.halobject.py
, the_queue_msg
function is called to queue each incoming message to an agent or module. The filtering could be done here (it could also be done on receive, to put it on the receiver's event queue, but it doesn't really make too much of a difference I think). So before queuing the message, the message should be passed to each of the registered filter's filter method, which returns a perhaps different ("preprocessed", perhaps) message orNone
. IfNone
is returned, the message should be dropped, not passed to any more filters and not queued.The text was updated successfully, but these errors were encountered: