bakwc / PySyncObj

A library for replicating your python class between multiple servers, based on raft protocol
MIT License
706 stars 113 forks source link

Custom Poller #159

Open 20zurmca opened 2 years ago

20zurmca commented 2 years ago

I have a use case where I need to make a custom Poller. Can we make the poller variable less ridged and provide the developer with options to use a custom poller class that inherits the Poller base class? This use case derived from making a custom threaded pub-sub transport, and I don't need the event-driven pollers.

If the idea is approved, I'll update the PR to do a check if pollerClass issubclass of Poller and I'll add to the docstring

Another thing I would like to point out but is not related to this post is that Transport class takes a SyncObj type in its constructor, and SyncObj can take a transport object. If a transport object is not given, the self keyword is passed in to the transportClass constructor which is in the PySyncObj constructor. This circular dependency makes creating a custom transport object outside of the PySyncObj constructor confusing. Maybe we can think of a redesign for the constructors so that custom transport objects can be made more intuitively.

Thanks!