Package com.yahoo.vespa.config.protocol
Class JRTClientConfigRequestV3
java.lang.Object
com.yahoo.vespa.config.protocol.JRTClientConfigRequestV3
- All Implemented Interfaces:
JRTClientConfigRequest,JRTConfigRequest
Represents version 3 config request for config clients. Provides methods for inspecting request and response
values.
See
JRTServerConfigRequestV3 for protocol details.- Author:
- Ulf Lilleengen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Loggerprotected final com.yahoo.jrt.Requestprotected final com.yahoo.vespa.config.protocol.SlimeRequestData -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJRTClientConfigRequestV3(ConfigKey<?> key, String hostname, DefContent defSchema, PayloadChecksums payloadChecksums, long generation, long timeout, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckReturnTypes(com.yahoo.jrt.Request request) static JRTClientConfigRequestcreateFromRaw(RawConfig config, long serverTimeout, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) static <T extends com.yahoo.config.ConfigInstance>
JRTClientConfigRequestcreateFromSub(JRTConfigSubscription<T> sub, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) static JRTClientConfigRequestcreateWithParams(ConfigKey<?> reqKey, DefContent defContent, String hostname, PayloadChecksums payloadChecksums, long generation, long serverTimeout, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) protected static StringencodeAsUtf8String(com.yahoo.slime.Slime data) intReturns the error code of this requestReturn the error message of this request, mostly corresponding to theErrorCode.Returns the host name of the client that is requesting config.ConfigKey<?>Returns the config key of the config request.Get config definition content.protected StringGets the config checksums of the config returned by the server.longGet the generation of the newly provided config.Return the payload in the response given by the server.longReturns the config protocol versioncom.yahoo.jrt.RequestReturns the JRT request object for this config request.Returns the generation of the requested config.Returns the md5 of the config definition in the request.longReturns the generation of the requested config.protected com.yahoo.vespa.config.protocol.SlimeResponseDataGet theTracegiven in the response by the server.Returns a short hand description of this request.longReturns the server timeout of this request.Returns the Vespa version of the client that initiated the requestbooleanTest whether or not the response contains an updated config or not.booleanTest whether ot not the returned config has an updated generation.booleanisError()Test whether or not the returned request is an error.protected PayloadChecksumsprotected longnewGen()nextRequest(long timeout) Create a newJRTClientConfigRequestbased on this request based on the same request parameters, but having the timeout changed.booleanReturns true if this config should only be applied at the last restart, false if it should be applied immediatelytoString()booleanPerforms request parameter validation of this config request.booleanValidate config response given by the server.
-
Field Details
-
log
-
requestData
protected final com.yahoo.vespa.config.protocol.SlimeRequestData requestData -
request
protected final com.yahoo.jrt.Request request
-
-
Constructor Details
-
JRTClientConfigRequestV3
protected JRTClientConfigRequestV3(ConfigKey<?> key, String hostname, DefContent defSchema, PayloadChecksums payloadChecksums, long generation, long timeout, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion)
-
-
Method Details
-
encodeAsUtf8String
-
getJRTMethodName
-
checkReturnTypes
protected boolean checkReturnTypes(com.yahoo.jrt.Request request) -
getNewPayload
Description copied from interface:JRTClientConfigRequestReturn the payload in the response given by the server. The payload will be empty if no response was given.- Specified by:
getNewPayloadin interfaceJRTClientConfigRequest- Returns:
- the config payload.
-
getProtocolVersion
public long getProtocolVersion()Description copied from interface:JRTConfigRequestReturns the config protocol version- Specified by:
getProtocolVersionin interfaceJRTConfigRequest- Returns:
- a protocol version number.
-
nextRequest
Description copied from interface:JRTClientConfigRequestCreate a newJRTClientConfigRequestbased on this request based on the same request parameters, but having the timeout changed.- Specified by:
nextRequestin interfaceJRTClientConfigRequest- Parameters:
timeout- server timeout of the new request.- Returns:
- a new
JRTClientConfigRequestinstance.
-
createFromSub
public static <T extends com.yahoo.config.ConfigInstance> JRTClientConfigRequest createFromSub(JRTConfigSubscription<T> sub, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) -
createFromRaw
public static JRTClientConfigRequest createFromRaw(RawConfig config, long serverTimeout, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) -
createWithParams
public static JRTClientConfigRequest createWithParams(ConfigKey<?> reqKey, DefContent defContent, String hostname, PayloadChecksums payloadChecksums, long generation, long serverTimeout, Trace trace, CompressionType compressionType, Optional<VespaVersion> vespaVersion) -
getVespaVersion
Description copied from interface:JRTConfigRequestReturns the Vespa version of the client that initiated the request- Specified by:
getVespaVersionin interfaceJRTConfigRequest- Returns:
- Vespa version of the client
-
getConfigKey
Description copied from interface:JRTConfigRequestReturns the config key of the config request.- Specified by:
getConfigKeyin interfaceJRTConfigRequest- Returns:
- a
ConfigKey.
-
toString
-
getClientHostName
Description copied from interface:JRTConfigRequestReturns the host name of the client that is requesting config.- Specified by:
getClientHostNamein interfaceJRTConfigRequest- Returns:
- hostname of the client.
-
getRequest
public com.yahoo.jrt.Request getRequest()Description copied from interface:JRTConfigRequestReturns the JRT request object for this config request. TODO: This method leaks the internal jrt stuff :(- Specified by:
getRequestin interfaceJRTConfigRequest- Returns:
- a
Requestobject.
-
errorCode
public int errorCode()Description copied from interface:JRTConfigRequestReturns the error code of this request- Specified by:
errorCodein interfaceJRTConfigRequest- Returns:
- the error code as defined in
ErrorCode.
-
errorMessage
Description copied from interface:JRTConfigRequestReturn the error message of this request, mostly corresponding to theErrorCode.- Specified by:
errorMessagein interfaceJRTConfigRequest- Returns:
- the error message.
-
getShortDescription
Description copied from interface:JRTConfigRequestReturns a short hand description of this request.- Specified by:
getShortDescriptionin interfaceJRTConfigRequest- Returns:
- a short description
-
hasUpdatedGeneration
public boolean hasUpdatedGeneration()Description copied from interface:JRTClientConfigRequestTest whether ot not the returned config has an updated generation. This should return false if no response have been given.- Specified by:
hasUpdatedGenerationin interfaceJRTClientConfigRequest- Returns:
- true if generation is updated, false if not.
-
getTimeout
public long getTimeout()Description copied from interface:JRTConfigRequestReturns the server timeout of this request.- Specified by:
getTimeoutin interfaceJRTConfigRequest- Returns:
- the timeout given to the server
-
newConfigChecksums
-
newGen
protected long newGen() -
getDefContent
Description copied from interface:JRTClientConfigRequestGet config definition content.- Specified by:
getDefContentin interfaceJRTClientConfigRequest- Returns:
- def as lines.
-
isError
public boolean isError()Description copied from interface:JRTClientConfigRequestTest whether or not the returned request is an error.- Specified by:
isErrorin interfaceJRTClientConfigRequest- Returns:
- true if error, false if not.
-
hasUpdatedConfig
public boolean hasUpdatedConfig()Description copied from interface:JRTClientConfigRequestTest whether or not the response contains an updated config or not. False if no response has been returned.- Specified by:
hasUpdatedConfigin interfaceJRTClientConfigRequest- Returns:
- true if config is updated, false if not.
-
getResponseTrace
Description copied from interface:JRTClientConfigRequestGet theTracegiven in the response by the server. TheTracecan be used to add further tracing and later printed to provide useful debug info.- Specified by:
getResponseTracein interfaceJRTClientConfigRequest- Returns:
- a
Trace.
-
getRequestDefMd5
Description copied from interface:JRTConfigRequestReturns the md5 of the config definition in the request.- Specified by:
getRequestDefMd5in interfaceJRTConfigRequest- Returns:
- an md5 of config definition in request.
-
getRequestConfigChecksums
Description copied from interface:JRTConfigRequestReturns the generation of the requested config. If none has been given, 0 should be returned. Returns the checksum of the config request. Return an empty string if no response has been returned.- Specified by:
getRequestConfigChecksumsin interfaceJRTConfigRequest- Returns:
- a config checksum.
-
validateResponse
public boolean validateResponse()Description copied from interface:JRTClientConfigRequestValidate config response given by the server. If none is given, or an error occurred, this should return false.- Specified by:
validateResponsein interfaceJRTClientConfigRequest- Returns:
- true if valid response, false if not.
-
validateParameters
public boolean validateParameters()Description copied from interface:JRTConfigRequestPerforms request parameter validation of this config request. This method should be called before fetching any kind of config protocol-specific parameter.- Specified by:
validateParametersin interfaceJRTConfigRequest- Returns:
- true if valid, false if not.
-
getNewChecksums
Description copied from interface:JRTClientConfigRequestGets the config checksums of the config returned by the server. Returns an empty string if no response has been returned.- Specified by:
getNewChecksumsin interfaceJRTClientConfigRequest- Returns:
- a config checksum.
-
getNewGeneration
public long getNewGeneration()Description copied from interface:JRTClientConfigRequestGet the generation of the newly provided config. If none has been given, 0 should be returned.- Specified by:
getNewGenerationin interfaceJRTClientConfigRequest- Returns:
- the new generation.
-
responseIsApplyOnRestart
public boolean responseIsApplyOnRestart()Description copied from interface:JRTClientConfigRequestReturns true if this config should only be applied at the last restart, false if it should be applied immediately- Specified by:
responseIsApplyOnRestartin interfaceJRTClientConfigRequest
-
getRequestGeneration
public long getRequestGeneration()Description copied from interface:JRTConfigRequestReturns the generation of the requested config. If none has been given, 0 should be returned.- Specified by:
getRequestGenerationin interfaceJRTConfigRequest- Returns:
- the generation in the request.
-
getResponseData
protected com.yahoo.vespa.config.protocol.SlimeResponseData getResponseData()
-