worryg0d commented on code in PR #1929:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2932266942
##########
cluster.go:
##########
@@ -394,6 +405,55 @@ func (cfg *ClusterConfig) filterHost(host *HostInfo) bool {
return !(cfg.HostFilter == nil || cfg.HostFilter.Accept(host))
}
+// MetadataConfig configures driver's internal metadata caching and event
listening.
+type MetadataConfig struct {
+ // CacheMode controls how the driver reads and caches schema metadata
from Cassandra system tables.
+ //
+ // Also, it affects the behavior of schema change listeners.
+ //
+ // If CacheMode is [KeyspaceOnly], only [KeyspaceChangeListener] will
be notified,
+ // having other listeners registered will result in an error during
session creation.
+ //
+ // If CacheMode is [Disabled], having these listeners will result in an
error during session creation.
+ //
+ // See [MetadataCacheMode] for more details.
+ CacheMode MetadataCacheMode
+
+ // HostListener will be notified when host state and topology changes
occur.
+ //
+ // Consider using [HostListenersMux] if you need to register multiple
listeners for the same type of host state and topology change.
+ HostListener HostListenersConfig
+
+ // SchemaListener will be notified when schema changes occur.
+ //
+ // Consider using [SchemaListenersMux] if you need to register multiple
listeners for the same type of schema change.
+ SchemaListener SchemaListenersConfig
+
+ // ReadyListener will be notified when the session is ready to be used.
+ // This is meant to be implemented by Host and Schema listeners but it
can also be used as
+ // a generic callback for when the session is ready regardless of
whether a metadata listener is implemented or not.
+ //
+ // Consider using [SessionReadyListenersMux] if you need to register
multiple listeners for the same session ready event.
+ ReadyListener SessionReadyListener
+}
Review Comment:
Added a simple integration test `TestSessionReadyEvent` - had to spend some
time figuring out why listener was called twice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]