public enum VersionType extends java.lang.Enum<VersionType> implements Writeable
Writeable.Reader<V>, Writeable.Writer<V>
Enum Constant and Description |
---|
EXTERNAL |
EXTERNAL_GTE |
FORCE
Deprecated.
this version type will be removed in the next major version
|
INTERNAL |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.String |
explainConflictForReads(long currentVersion,
long expectedVersion)
Returns a human readable explanation for a version conflict on read.
|
abstract java.lang.String |
explainConflictForWrites(long currentVersion,
long expectedVersion,
boolean deleted)
Returns a human readable explanation for a version conflict on write.
|
static VersionType |
fromString(java.lang.String versionType) |
static VersionType |
fromString(java.lang.String versionType,
VersionType defaultVersionType) |
static VersionType |
fromValue(byte value) |
byte |
getValue() |
abstract boolean |
isVersionConflictForReads(long currentVersion,
long expectedVersion)
Checks whether the current version conflicts with the expected version, based on the current version type.
|
abstract boolean |
isVersionConflictForWrites(long currentVersion,
long expectedVersion,
boolean deleted)
Checks whether the current version conflicts with the expected version, based on the current version type.
|
static VersionType |
readFromStream(StreamInput in) |
abstract long |
updateVersion(long currentVersion,
long expectedVersion)
Returns the new version for a document, based on its current one and the specified in the request
|
abstract boolean |
validateVersionForReads(long version)
validate the version is a valid value for this type when reading.
|
abstract boolean |
validateVersionForWrites(long version)
validate the version is a valid value for this type when writing.
|
static VersionType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static VersionType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
VersionType |
versionTypeForReplicationAndRecovery()
Some version types require different semantics for primary and replicas.
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
public static final VersionType INTERNAL
public static final VersionType EXTERNAL
public static final VersionType EXTERNAL_GTE
@Deprecated public static final VersionType FORCE
public static VersionType[] values()
for (VersionType c : VersionType.values()) System.out.println(c);
public static VersionType valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic byte getValue()
public abstract boolean isVersionConflictForWrites(long currentVersion, long expectedVersion, boolean deleted)
currentVersion
- the current version for the documentexpectedVersion
- the version specified for the write operationdeleted
- true if the document is currently deleted (note that #currentVersion will typically be
Versions.NOT_FOUND
, but may be something else if the document was recently deletedpublic abstract java.lang.String explainConflictForWrites(long currentVersion, long expectedVersion, boolean deleted)
isVersionConflictForWrites(long, long, boolean)
returns true;currentVersion
- the current version for the documentexpectedVersion
- the version specified for the write operationdeleted
- true if the document is currently deleted (note that #currentVersion will typically be
Versions.NOT_FOUND
, but may be something else if the document was recently deletedpublic abstract boolean isVersionConflictForReads(long currentVersion, long expectedVersion)
currentVersion
- the current version for the documentexpectedVersion
- the version specified for the read operationpublic abstract java.lang.String explainConflictForReads(long currentVersion, long expectedVersion)
isVersionConflictForReads(long, long)
returns true;currentVersion
- the current version for the documentexpectedVersion
- the version specified for the read operationpublic abstract long updateVersion(long currentVersion, long expectedVersion)
public abstract boolean validateVersionForWrites(long version)
public abstract boolean validateVersionForReads(long version)
public VersionType versionTypeForReplicationAndRecovery()
public static VersionType fromString(java.lang.String versionType)
public static VersionType fromString(java.lang.String versionType, VersionType defaultVersionType)
public static VersionType fromValue(byte value)
public static VersionType readFromStream(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable