Dynamic computation of contacts.
If you run cassandra in a k8s cluster, it changes IP addresses occasionally. If that happens, and cql-io loses a connection, we want it to do a DNS lookup for the new contacts list before attempting a re-connect.
I would try something like this:
diff --git a/src/Database/CQL/IO/Settings.hs b/src/Database/CQL/IO/Settings.hs
index 38e7539..d79f9e5 100644
--- a/src/Database/CQL/IO/Settings.hs
+++ b/src/Database/CQL/IO/Settings.hs
@@ -34,11 +34,15 @@ data Settings = Settings
, _retrySettings :: RetrySettings
, _protoVersion :: Version
, _portnumber :: PortNumber
- , _contacts :: NonEmpty String
+ , _contacts :: GetContacts
, _policyMaker :: IO Policy
, _prepStrategy :: PrepareStrategy
}
+data GetContacts
+ = HaveContacts (NonEmpty String)
+ | GetContacts (IO (NonEmpty String))
+
-- | Strategy for the execution of 'PrepQuery's.
data PrepareStrategy
= EagerPrepare -- ^ cluster-wide preparation
I am about to dig into this a little deeper, but before I start I wanted to give you a chance to have an opinion. :-)
cheers~