worryg0d commented on code in PR #1929:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2930619276


##########
metadata.go:
##########
@@ -2049,3 +2101,319 @@ func isIdentifierChar(c byte) bool {
                c == '_' ||
                c == '&'
 }
+
+// Handles the full schema changes including table, user type, function, 
aggregate.
+func handleFullSchemaChanges(session *Session, oldKeyspaces, newKeyspaces 
map[string]*KeyspaceMetadata) {
+       for _, oldKsMeta := range oldKeyspaces {
+               newKsMeta, ok := newKeyspaces[oldKsMeta.Name]
+               if !ok {
+                       // Skip, KeyspaceChangeListener is already notified in 
refreshSchemas()
+                       continue
+               }
+
+               if session.schemaChangeListeners.TableChangeListener != nil {

Review Comment:
   I mean this too verbose:
   ```
                if session.schemaListeners.hasTable() {
                        handleSchemaTableChanges(session, oldKsMeta, newKsMeta)
                }
                if session.schemaListeners.hasUserType() {
                        handleSchemaUserTypeChanges(session, oldKsMeta, 
newKsMeta)
                }
                if session.schemaListeners.hasFunction() {
                        handleSchemaFunctionChanges(session, oldKsMeta, 
newKsMeta)
                }
                if session.schemaListeners.hasAggregate() {
                        handleSchemaAggregateChanges(session, oldKsMeta, 
newKsMeta)
                }
   ```
   
   Actually, it would be much easier if we had a kind of event bus and 
subscribed schema listeners and policy to it, so no need to explicitly call 
them in `refreshSchemas()` 



-- 
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]

Reply via email to