public interface TopologyService
It's expected that each instance of ClusterAwareConnectionProxy uses it's own instance of topology service.
Modifier and Type | Method and Description |
---|---|
void |
addToDownHostList(@Nullable HostInfo downHost)
Mark host as down.
|
void |
clear()
Clear topology service for the current cluster.
|
void |
clearAll()
Clear topology service for all clusters.
|
@Nullable List<HostInfo> |
getCachedTopology()
Get cached topology.
|
Set<String> |
getDownHosts()
Get a set of host names that were marked down.
|
@Nullable HostInfo |
getLastUsedReaderHost()
Get details about the most recent reader that the driver has successfully connected to.
|
List<HostInfo> |
getTopology(Connection conn,
boolean forceUpdate)
Get cluster topology.
|
void |
removeFromDownHostList(HostInfo host)
Unmark host as down.
|
void |
setClusterId(String clusterId)
Set unique cluster identifier for topology service instance.
|
void |
setClusterInstanceTemplate(HostInfo clusterInstanceTemplate)
Sets host details common to each instance in the cluster, including the host dns pattern.
|
void |
setLastUsedReaderHost(@Nullable HostInfo reader)
Set details about the most recent reader that the driver has connected to.
|
void |
setRefreshRate(int refreshRate)
Set new topology refresh rate.
|
void setClusterId(String clusterId)
Cluster could be accessed through different connection strings like IP address, cluster dns endpoint, instance dns endpoint, custom domain alias (CNAME), etc. Cluster Id can be any string that unique identify a cluster despite the way it's been accessed.
clusterId
- Cluster unique identifier.void setClusterInstanceTemplate(HostInfo clusterInstanceTemplate)
Examples: "?.mydomain.com", "db-instance.?.mydomain.com"
clusterInstanceTemplate
- Cluster instance details including host dns pattern.List<HostInfo> getTopology(Connection conn, boolean forceUpdate)
conn
- A connection to database to fetch the latest topology, if needed.forceUpdate
- If true, it forces a service to ignore cached copy of topology and to fetch
a fresh one.@Nullable List<HostInfo> getCachedTopology()
@Nullable HostInfo getLastUsedReaderHost()
void setLastUsedReaderHost(@Nullable HostInfo reader)
reader
- A reader host.Set<String> getDownHosts()
void addToDownHostList(@Nullable HostInfo downHost)
downHost
- The HostInfo
object representing the host to mark as downvoid removeFromDownHostList(HostInfo host)
host
- The HostInfo
object representing the host to remove from the list of down hostsvoid setRefreshRate(int refreshRate)
refreshRate
- Topology refresh rate in millis.void clearAll()
void clear()
Copyright © 1997-2021 PostgreSQL Global Development Group. All Rights Reserved.