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, String defMd5)
Constructor for an empty config (not yet resolved).RawConfig(ConfigKey<?> key, String defMd5, Payload payload, PayloadChecksums payloadChecksums, long generation, boolean applyOnRestart, int errorCode, List<String> defContent, Optional<VespaVersion> vespaVersion)
RawConfig(ConfigKey<?> key, String defMd5, Payload payload, PayloadChecksums payloadChecksums, long generation, boolean applyOnRestart, List<String> defContent, Optional<VespaVersion> vespaVersion)
RawConfig(RawConfig rawConfig)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
applyOnRestart()
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(Object o)
int
errorCode()
String
getConfigId()
List<String>
getDefContent()
String
getDefMd5()
String
getDefNamespace()
long
getGeneration()
ConfigKey<?>
getKey()
String
getName()
String
getNamespace()
Payload
getPayload()
PayloadChecksums
getPayloadChecksums()
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.void
setApplyOnRestart(boolean applyOnRestart)
void
setGeneration(long generation)
String
toString()
-
Methods inherited from class com.yahoo.config.ConfigInstance
getConfigMd5, getDefName, getDefNamespace, serialize, serialize, setConfigMd5
-
-
-
-
Constructor Detail
-
RawConfig
public RawConfig(ConfigKey<?> key, 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, String defMd5, Payload payload, PayloadChecksums payloadChecksums, long generation, boolean applyOnRestart, List<String> defContent, Optional<VespaVersion> vespaVersion)
-
RawConfig
public RawConfig(RawConfig rawConfig)
Copy constructor
-
RawConfig
public RawConfig(ConfigKey<?> key, String defMd5, Payload payload, PayloadChecksums payloadChecksums, long generation, boolean applyOnRestart, int errorCode, List<String> defContent, 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 String getName()
-
getNamespace
public String getNamespace()
-
getConfigId
public String getConfigId()
-
getDefMd5
public String getDefMd5()
-
getGeneration
public long getGeneration()
-
setGeneration
public void setGeneration(long generation)
-
setApplyOnRestart
public void setApplyOnRestart(boolean applyOnRestart)
-
applyOnRestart
public boolean applyOnRestart()
-
getPayload
public Payload getPayload()
-
errorCode
public int errorCode()
-
getDefNamespace
public String getDefNamespace()
-
getVespaVersion
public Optional<VespaVersion> getVespaVersion()
-
getPayloadChecksums
public PayloadChecksums getPayloadChecksums()
-
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(Object o)
- Overrides:
equals
in classcom.yahoo.config.InnerNode
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.yahoo.config.InnerNode
-
toString
public String toString()
- Overrides:
toString
in classcom.yahoo.config.InnerNode
-
-