Package com.yahoo.vespa.config
Class RawConfig
- java.lang.Object
-
- com.yahoo.config.Node
-
- com.yahoo.config.InnerNode
-
- com.yahoo.config.ConfigInstance
-
- com.yahoo.vespa.config.RawConfig
-
public class RawConfig extends com.yahoo.config.ConfigInstance
Encapsulates config, usually associated with aJRTConfigRequest
. An instance of this class can represent either a config that is not yet resolved, a successfully resolved config, or an error.- Author:
- hmusum
-
-
Constructor Summary
Constructors Constructor Description RawConfig(ConfigKey<?> key, java.lang.String defMd5)
Constructor for an empty config (not yet resolved).RawConfig(ConfigKey<?> key, java.lang.String defMd5, Payload payload, java.lang.String configMd5, long generation, boolean internalRedeploy, int errorCode, java.util.List<java.lang.String> defContent, java.util.Optional<VespaVersion> vespaVersion)
RawConfig(ConfigKey<?> key, java.lang.String defMd5, Payload payload, java.lang.String configMd5, long generation, boolean internalRedeploy, java.util.List<java.lang.String> defContent, java.util.Optional<VespaVersion> vespaVersion)
RawConfig(RawConfig rawConfig)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RawConfig
createFromResponseParameters(JRTClientConfigRequest req)
Creates a new Config from the given request, with the values in the response parameters.static RawConfig
createFromServerRequest(JRTServerConfigRequest req)
Creates a new Config from the given request, with the values in the response parameters.boolean
equals(java.lang.Object o)
int
errorCode()
java.lang.String
getConfigId()
java.lang.String
getConfigMd5()
java.util.List<java.lang.String>
getDefContent()
java.lang.String
getDefMd5()
java.lang.String
getDefNamespace()
long
getGeneration()
ConfigKey<?>
getKey()
java.lang.String
getName()
java.lang.String
getNamespace()
Payload
getPayload()
java.util.Optional<VespaVersion>
getVespaVersion()
boolean
hasEqualConfig(JRTServerConfigRequest req)
Returns true if this config is equal to the config (same payload md5) in the given request.int
hashCode()
boolean
hasNewerGeneration(JRTServerConfigRequest req)
Returns true if this config has a more recent generation than the config in the given request.boolean
isError()
Convenience method.boolean
isInternalRedeploy()
Returns whether this config generation was created by a system internal redeploy, not an application package change.void
setGeneration(long generation)
void
setInternalRedeploy(boolean internalRedeploy)
java.lang.String
toString()
-
Methods inherited from class com.yahoo.config.ConfigInstance
getDefName, getDefNamespace, serialize, serialize, setConfigMd5
-
-
-
-
Constructor Detail
-
RawConfig
public RawConfig(ConfigKey<?> key, java.lang.String defMd5)
Constructor for an empty config (not yet resolved).- Parameters:
key
- The ConfigKeydefMd5
- The md5 sum of the .def-file.
-
RawConfig
public RawConfig(ConfigKey<?> key, java.lang.String defMd5, Payload payload, java.lang.String configMd5, long generation, boolean internalRedeploy, java.util.List<java.lang.String> defContent, java.util.Optional<VespaVersion> vespaVersion)
-
RawConfig
public RawConfig(RawConfig rawConfig)
Copy constructor
-
RawConfig
public RawConfig(ConfigKey<?> key, java.lang.String defMd5, Payload payload, java.lang.String configMd5, long generation, boolean internalRedeploy, int errorCode, java.util.List<java.lang.String> defContent, java.util.Optional<VespaVersion> vespaVersion)
-
-
Method Detail
-
createFromResponseParameters
public static RawConfig createFromResponseParameters(JRTClientConfigRequest req)
Creates a new Config from the given request, with the values in the response parameters.- Parameters:
req
- aJRTClientConfigRequest
-
createFromServerRequest
public static RawConfig createFromServerRequest(JRTServerConfigRequest req)
Creates a new Config from the given request, with the values in the response parameters.- Parameters:
req
- aJRTClientConfigRequest
-
getKey
public ConfigKey<?> getKey()
-
getName
public java.lang.String getName()
-
getNamespace
public java.lang.String getNamespace()
-
getConfigId
public java.lang.String getConfigId()
-
getConfigMd5
public java.lang.String getConfigMd5()
- Overrides:
getConfigMd5
in classcom.yahoo.config.ConfigInstance
-
getDefMd5
public java.lang.String getDefMd5()
-
getGeneration
public long getGeneration()
-
setGeneration
public void setGeneration(long generation)
-
setInternalRedeploy
public void setInternalRedeploy(boolean internalRedeploy)
-
isInternalRedeploy
public boolean isInternalRedeploy()
Returns whether this config generation was created by a system internal redeploy, not an application package change.
-
getPayload
public Payload getPayload()
-
errorCode
public int errorCode()
-
getDefNamespace
public java.lang.String getDefNamespace()
-
getVespaVersion
public java.util.Optional<VespaVersion> getVespaVersion()
-
hasEqualConfig
public boolean hasEqualConfig(JRTServerConfigRequest req)
Returns true if this config is equal to the config (same payload md5) in the given request.- Parameters:
req
- the request for which to compare config payload with this config.- Returns:
- true if this config is equal to the config in the given request.
-
hasNewerGeneration
public boolean hasNewerGeneration(JRTServerConfigRequest req)
Returns true if this config has a more recent generation than the config in the given request.- Parameters:
req
- the request for which to compare generation with this config.- Returns:
- true if this config has a more recent generation than the config in the given request.
-
isError
public boolean isError()
Convenience method.- Returns:
- true if errorCode() returns 0, false otherwise.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classcom.yahoo.config.InnerNode
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.yahoo.config.InnerNode
-
toString
public java.lang.String toString()
- Overrides:
toString
in classcom.yahoo.config.InnerNode
-
getDefContent
public java.util.List<java.lang.String> getDefContent()
-
-