-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for direct DNS lookups behind a feature flag.
- Loading branch information
Showing
9 changed files
with
143 additions
and
6 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
db-client-java/src/main/java/com/eventstore/dbclient/ClientFeatureFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.eventstore.dbclient; | ||
|
||
public final class ClientFeatureFlags { | ||
/** | ||
* Enables direct DNS name resolution, retrieving all IP addresses associated with a given hostname. This | ||
* functionality was initially implemented to support the now-deprecated TCP API. It is particularly useful in | ||
* scenarios involving clusters, where node discovery is enabled. | ||
*/ | ||
public static final String DnsLookup = "dns-lookup"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
db-client-java/src/main/java/com/eventstore/dbclient/resolution/DeferredNodeResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.eventstore.dbclient.resolution; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class DeferredNodeResolution implements NodeResolution { | ||
private final InetSocketAddress address; | ||
|
||
public DeferredNodeResolution(InetSocketAddress address) { | ||
this.address = address; | ||
} | ||
|
||
@Override | ||
public List<InetSocketAddress> resolve() { | ||
return Collections.singletonList(address); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...lient-java/src/main/java/com/eventstore/dbclient/resolution/DeprecatedNodeResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.eventstore.dbclient.resolution; | ||
|
||
import java.net.InetAddress; | ||
import java.net.InetSocketAddress; | ||
import java.net.UnknownHostException; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class DeprecatedNodeResolution implements NodeResolution { | ||
private final InetSocketAddress address; | ||
|
||
public DeprecatedNodeResolution(InetSocketAddress address) { | ||
this.address = address; | ||
} | ||
|
||
@Override | ||
public List<InetSocketAddress> resolve() { | ||
try { | ||
return Arrays.stream(InetAddress.getAllByName(address.getHostName())) | ||
.map(addr -> new InetSocketAddress(addr, address.getPort())) | ||
.collect(Collectors.toList()); | ||
} catch (UnknownHostException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...lient-java/src/main/java/com/eventstore/dbclient/resolution/FixedSeedsNodeResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.eventstore.dbclient.resolution; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class FixedSeedsNodeResolution implements NodeResolution { | ||
private final InetSocketAddress[] seeds; | ||
|
||
public FixedSeedsNodeResolution(InetSocketAddress[] seeds) { | ||
this.seeds = seeds; | ||
} | ||
|
||
@Override | ||
public List<InetSocketAddress> resolve() { | ||
return Arrays.asList(seeds); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
db-client-java/src/main/java/com/eventstore/dbclient/resolution/NodeResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.eventstore.dbclient.resolution; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.util.List; | ||
|
||
public interface NodeResolution { | ||
List<InetSocketAddress> resolve(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters