worryg0d commented on code in PR #1929: URL: https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2931176345
########## event_listeners.go: ########## @@ -0,0 +1,497 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * Content before git sha 34fdeebefcbf183ed7f916f931aa0586fdaa1b40 + * Copyright (c) 2012, The Gocql authors, + * provided under the BSD-3-Clause License. + * See the NOTICE file distributed with this work for additional information. + */ + +package gocql + +// SessionReadyListener is notified when the session is ready to be used. +// This is useful for users who need to know when the session is ready to be used. +type SessionReadyListener interface { + OnSessionReady() +} + +// TopologyChangeListener receives topology change events. +// Host may be nil if the node is not yet known to the ring. +type TopologyChangeListener interface { + OnNewHost(event NewHostEvent) + OnRemovedHost(event RemovedHostEvent) +} + +type NewHostEvent struct { + Host *HostInfo +} + +type RemovedHostEvent struct { + Host *HostInfo +} + +type HostStatusChangeListener interface { + OnHostUp(event HostUpEvent) + OnHostDown(event HostDownEvent) +} + +type HostUpEvent struct { + Host *HostInfo +} + +type HostDownEvent struct { + Host *HostInfo +} + +type KeyspaceChangeListener interface { + OnKeyspaceCreated(event OnKeyspaceCreatedEvent) + OnKeyspaceUpdated(event OnKeyspaceUpdatedEvent) + OnKeyspaceDropped(event OnKeyspaceDroppedEvent) +} + +type TableChangeListener interface { + OnTableCreated(event OnTableCreatedEvent) + OnTableUpdated(event OnTableUpdatedEvent) + OnTableDropped(event OnTableDroppedEvent) +} + +type UserTypeChangeListener interface { + OnUserTypeCreated(event OnUserTypeCreatedEvent) + OnUserTypeUpdated(event OnUserTypeUpdatedEvent) + OnUserTypeDropped(event OnUserTypeDroppedEvent) +} + +type FunctionChangeListener interface { + OnFunctionCreated(event OnFunctionCreatedEvent) + OnFunctionUpdated(event OnFunctionUpdatedEvent) + OnFunctionDropped(event OnFunctionDroppedEvent) +} + +type AggregateChangeListener interface { + OnAggregateCreated(event OnAggregateCreatedEvent) + OnAggregateUpdated(event OnAggregateUpdatedEvent) + OnAggregateDropped(event OnAggregateDroppedEvent) +} + +type OnKeyspaceCreatedEvent struct { + Keyspace *KeyspaceMetadata +} + +type OnKeyspaceUpdatedEvent struct { + Old *KeyspaceMetadata + New *KeyspaceMetadata +} + +type OnKeyspaceDroppedEvent struct { + Keyspace *KeyspaceMetadata +} + +type OnTableCreatedEvent struct { + Table *TableMetadata +} + +type OnTableUpdatedEvent struct { + Old *TableMetadata + New *TableMetadata +} + +type OnTableDroppedEvent struct { + Table *TableMetadata +} + +type OnUserTypeCreatedEvent struct { + UserType *UserTypeMetadata +} + +type OnUserTypeUpdatedEvent struct { + Old *UserTypeMetadata + New *UserTypeMetadata +} + +type OnUserTypeDroppedEvent struct { + UserType *UserTypeMetadata +} + +type OnFunctionCreatedEvent struct { + Function *FunctionMetadata +} + +type OnFunctionUpdatedEvent struct { + Old *FunctionMetadata + New *FunctionMetadata +} + +type OnFunctionDroppedEvent struct { + Function *FunctionMetadata +} + +type OnAggregateCreatedEvent struct { + Aggregate *AggregateMetadata +} + +type OnAggregateUpdatedEvent struct { + Old *AggregateMetadata + New *AggregateMetadata +} + +type OnAggregateDroppedEvent struct { + Aggregate *AggregateMetadata +} + +// SchemaChangeListenersMux is a multiplexer for schema change listeners. +// Allows to register multiple listeners for the same type of schema change. +type SchemaChangeListenersMux struct { Review Comment: Changed name to `SchemaListenersMux` -- 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]

