krojew/cdrs-tokio

Add new dynamic cluster handling

Closed this issue · 13 comments

Add new dynamic cluster handling

Could you elaborate on this?

Available node list should be dynamically updated from server events.

I am currently working on a PR for that :)

I was planning to rework event handling for that to work first in #32 . Current iterator-based approach works very poorly with async/await.

Would you be able to give more implementation details? I can look at completing that before I submit my PR if required.

At the moment, no work has been started on this topic, but I'm thinking of replacing whole existing implementation with automatically managing a dedicated extra connection for receiving events, and publishing them via tokio::sync::broadcast.

At the moment I have the connections stored in an ArcSwap so they can be updated, it is similar to the Scylla driver.

Ok, we can try to merge that first and rework the event system later.

I managed to find time to rework event handling and add cluster metadata handling skeleton. You can take a look at ClusterMetadataManager which should manage contained cluster metadata, which is then passed to load balancers.

I've done some work on the topology refresh branch of my fork but yours will probably end up being better. There's code for a TopologyReader which you might find useful.

Or I can take this code and reintegrate my solution?

Sure, rebase your changes on current master. Will welcome a PR with dynamic topology.

Dynamic topology is pretty much done. Now I need to add a load balancer taking advantage of this in #33 .