tengu-alt commented on code in PR #1874:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1874#discussion_r2035221889


##########
filters.go:
##########
@@ -24,39 +24,74 @@
 
 package gocql
 
-import "fmt"
+import (
+       "fmt"
+       "net"
+)
 
 // HostFilter interface is used when a host is discovered via server sent 
events.
 type HostFilter interface {
        // Called when a new host is discovered, returning true will cause the 
host
        // to be added to the pools.
-       Accept(host *HostInfo) bool
+       Accept(host Host) bool
+}
+
+// Host interface is provided to enable testing of custom implementations of 
the HostFilter interface.
+type Host interface {
+       Peer() net.IP
+       ConnectAddress() net.IP
+       BroadcastAddress() net.IP
+       ListenAddress() net.IP
+       RPCAddress() net.IP
+       PreferredIP() net.IP
+       DataCenter() string
+       Rack() string
+       HostID() string
+       WorkLoad() string
+       Graph() bool
+       DSEVersion() string
+       Partitioner() string
+       ClusterName() string
+       Version() CassVersion
+       Tokens() []string
+       Port() int
+       IsUp() bool
+       String() string
+}
+
+// Since cassVersion is an unexported type, the CassVersion interface is 
introduced
+// to allow better testability and increase test coverage.
+type CassVersion interface {
+       Set(v string) error
+       UnmarshalCQL(info TypeInfo, data []byte) error
+       AtLeast(major, minor, patch int) bool
+       String() string
 }
 
 // HostFilterFunc converts a func(host HostInfo) bool into a HostFilter

Review Comment:
   I think it also needs to be updated to `func(host Host) bool`



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to