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
Different devices cover different areas of the sub protocol and therefore would only be handling certain messages.
A few ideas for the design:
A MessageHandler struct that contains a HashMap<MessageType, Fn(), allowing a caller to assign a handler function to certain message types
More strictly defined traits by device e.g. PoolServer { fn on_message_xyz() }. This requires the implementation for each message that must be handled by that component.
More strictly defined traits by areas of responsiblity NOT by device e.g. ExtendedMiner { fn on_extended_xyz() }, StandardMiner { fn on_standard_xyz () }
Each component would need to implement a trait or just a simple method to match networked messages to the appropriate handler
Different devices cover different areas of the sub protocol and therefore would only be handling certain messages.
A few ideas for the design:
A
MessageHandler
struct that contains aHashMap<MessageType, Fn()
, allowing a caller to assign a handler function to certain message typesMore strictly defined traits by
device
e.g.PoolServer { fn on_message_xyz() }
. This requires the implementation for each message that must be handled by that component.More strictly defined traits by
areas of responsiblity
NOT bydevice
e.g.ExtendedMiner { fn on_extended_xyz() }
,StandardMiner { fn on_standard_xyz () }
Each component would need to implement a trait or just a simple method to match networked messages to the appropriate handler
The text was updated successfully, but these errors were encountered: