Enum FDBRecordStoreBase.VersionstampSaveBehavior
- java.lang.Object
-
- java.lang.Enum<FDBRecordStoreBase.VersionstampSaveBehavior>
-
- com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase.VersionstampSaveBehavior
-
- All Implemented Interfaces:
Serializable
,Comparable<FDBRecordStoreBase.VersionstampSaveBehavior>
- Enclosing interface:
- FDBRecordStoreBase<M extends Message>
public static enum FDBRecordStoreBase.VersionstampSaveBehavior extends Enum<FDBRecordStoreBase.VersionstampSaveBehavior>
Provided during record save (viaFDBRecordStoreBase.saveRecord(Message, FDBRecordVersion, VersionstampSaveBehavior)
), directs the behavior of the save w.r.t. the record's version. In the presence of a version, eitherDEFAULT
orWITH_VERSION
can be used. For safety,NO_VERSION
should only be used with a null version.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DEFAULT
Match the behavior dictated by the meta-data.IF_PRESENT
Save a record with a version if and only if a non-null version is passed toFDBRecordStoreBase.saveRecord(Message, FDBRecordVersion, VersionstampSaveBehavior)
.NO_VERSION
Do not save the record with a version.WITH_VERSION
Always save the record with a version.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FDBRecordStoreBase.VersionstampSaveBehavior
valueOf(String name)
Returns the enum constant of this type with the specified name.static FDBRecordStoreBase.VersionstampSaveBehavior[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DEFAULT
public static final FDBRecordStoreBase.VersionstampSaveBehavior DEFAULT
Match the behavior dictated by the meta-data. IfRecordMetaData.isStoreRecordVersions()
returnstrue
, this will always store the record with a version (likeWITH_VERSION
). Otherwise, it will store the record with the provided version if given or with no version if not.
-
NO_VERSION
public static final FDBRecordStoreBase.VersionstampSaveBehavior NO_VERSION
Do not save the record with a version. If a non-null version is provided toFDBRecordStoreBase.saveRecord(Message, FDBRecordVersion, VersionstampSaveBehavior)
, then an error will be thrown.
-
WITH_VERSION
public static final FDBRecordStoreBase.VersionstampSaveBehavior WITH_VERSION
Always save the record with a version. If a null version is provided, then the record store will chose a new version.Note: due to Issue #964, on some older record stores, namely those that were originally created with a format version below
FDBRecordStore.SAVE_VERSION_WITH_RECORD_FORMAT_VERSION
, records written with a version on stores whereRecordMetaData.isStoreRecordVersions()
isfalse
will not return the version with a record when read, even though the version will be stored. Users can avoid this by either migrating data to a new store or by settingisStoreRecordVersions()
totrue
in the meta-data and then supplying theNO_VERSION
when saving any records that do not need an associated version.
-
IF_PRESENT
public static final FDBRecordStoreBase.VersionstampSaveBehavior IF_PRESENT
Save a record with a version if and only if a non-null version is passed toFDBRecordStoreBase.saveRecord(Message, FDBRecordVersion, VersionstampSaveBehavior)
. In this mode, the record store will never assign a version to the record, but it will always use the version provided (or store the record with no version ifnull
). This is useful if one is copying data from one record store to another and one wants to preserve the versions (including non-versions) for each record.
-
-
Method Detail
-
values
public static FDBRecordStoreBase.VersionstampSaveBehavior[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FDBRecordStoreBase.VersionstampSaveBehavior c : FDBRecordStoreBase.VersionstampSaveBehavior.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FDBRecordStoreBase.VersionstampSaveBehavior valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-