-
Notifications
You must be signed in to change notification settings - Fork 15
[Conjure Java Runtime] Part 10: Drive a truck through the AtlasDbHttpClients API #4264
Conversation
Generate changelog in
|
@@ -210,6 +213,11 @@ boolean lockImmutableTsOnReadOnlyTransactions() { | |||
|
|||
abstract String userAgent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark this as deprecated?
@@ -258,10 +266,11 @@ public static TransactionManager createInMemory(Set<Schema> schemas) { | |||
AtlasDbConfig config = ImmutableAtlasDbConfig.builder().keyValueService(new InMemoryAtlasDbConfig()).build(); | |||
return builder() | |||
.config(config) | |||
.userAgent(UserAgents.DEFAULT_USER_AGENT) | |||
.userAgent(AtlasDbRemotingConstants.DEFAULT_USER_AGENT.toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you have to specify both? I think it should be an error if this is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're still keeping userAgent
around, and have a default structuredUserAgent
, this is sadly a little tricky to do
@@ -1005,7 +1022,7 @@ private static LockAndTimestampServices createRawLeaderServices( | |||
ServiceCreator.createTrustContext(leaderConfig.sslConfiguration()), | |||
Iterables.getOnlyElement(leaderConfig.leaders()), | |||
PingableLeader.class, | |||
userAgent); | |||
userAgent.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unconverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the underlying method to take a UserAgent object.
|
||
@Value.Default | ||
default UserAgent userAgent() { | ||
return AtlasDbRemotingConstants.DEFAULT_USER_AGENT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, not sure how I feel about a default user agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing: we removed the default.
public interface RemotingClientConfig { | ||
RemotingClientConfig DEFAULT = ImmutableRemotingClientConfig.builder().build(); | ||
|
||
default double maximumV2Probability() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably something a bit more descriptive of the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, changed
@@ -121,18 +123,16 @@ private AtlasDbHttpClients() { | |||
trustContextCreator, | |||
proxySelectorCreator, | |||
type, | |||
userAgent, | |||
limitPayload), | |||
clientParameters), | |||
DEFAULT_TARGET_FACTORY.getClientVersion()), | |||
ImmutableInstanceAndVersion.of(DEFAULT_TARGET_FACTORY.createLiveReloadingProxyWithFailover( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dunno whyI missed this last time, but the wrapper seems redundant, since the instance and the version is on the factory, unless I'm missing something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing: we pushed InstanceAndVersion
down into the TargetFactory
layer
@@ -32,31 +33,27 @@ | |||
Optional<TrustContext> trustContext, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the option to not retry can fold into AuxiliaryRemotingParameters
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing: yep, folded this in to AuxiliaryRemotingParameters
|
||
<T> T createProxyWithFailover( | ||
Optional<TrustContext> trustContext, | ||
Optional<ProxySelector> proxySelector, | ||
Collection<String> endpointUris, | ||
Class<T> type, | ||
String userAgent, | ||
boolean limitPayloadSize); | ||
AuxiliaryRemotingParameters parameters); | ||
|
||
<T> T createLiveReloadingProxyWithFailover( | ||
Supplier<ServerListConfig> serverListConfigSupplier, | ||
Function<SslConfiguration, TrustContext> trustContextCreator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also kill, these two parameters, i.e. trustContextCreator
and proxySelectorCreator
. We only have one impl, and it's never anything different. All the stuff we need is inside ServerListConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing: We removed these functions.
|
||
<T> T createProxy( | ||
Optional<TrustContext> trustContext, | ||
String uri, | ||
Class<T> type, | ||
String userAgent, | ||
boolean limitPayloadSize); | ||
AuxiliaryRemotingParameters parameters); | ||
|
||
<T> T createProxyWithFailover( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should then make this a default that just takes in a ServerListConfig
and then returns a static supplier to the createLiveReloadingProxyWithFailover
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this, we only have two methods to implement 💃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing: Sadly it goes the other way (the live reloading one falls back to this) so it's not as straightforward
changelog/@unreleased/pr-4264.v2.yml
Outdated
.build(); | ||
``` | ||
|
||
`userAgent` and `remotingClientConfig` are optional; `shouldLimitPayload` is compulsory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I agree about userAgent being optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, we made it compulsory (I'll need to change the docs).
Goals (and why):
String userAgent, boolean limitPayloadSize, RemotingClientConfig config
Implementation Description (bullets):
AuxiliaryRemotingParameters
structTesting (What was existing testing like? What have you done to improve it?):
Not much. Existing tests still work (some were changed as they asserted over-specific things IMO).
Concerns (what feedback would you like?):
Where should we start reviewing?:
Priority (whenever / two weeks / yesterday): this week would be great!