You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We need to generate a 80-bits stamp, and also need to mark it as 'incomplete' by forcing the highest bit to 1.
306
+
// Since this is supposed to be a version number with a ~1M tickrate per seconds, we will play it safe, and force the 8 highest bits to 1,
307
+
// meaning that we only reduce the database potential lifetime but 1/256th, before getting into trouble.
308
+
//
309
+
// By doing some empirical testing, it also seems that the last 16 bits are a transction batch order which is usually a low number.
310
+
// Again, we will force the 4 highest bit to 1 to reduce the change of collision with a complete version stamp.
311
+
//
312
+
// So the final token will look like: 'FF xx xx xx xx xx xx xx Fy yy', were 'x' is the random token, and 'y' will lowest 12 bits of the transaction retry count
/// <summary>Return a place-holder 80-bit VersionStamp, whose value is not yet known, but will be filled by the database at commit time.</summary>
336
+
/// <returns>This value can used to generate temporary keys or value, for use with the <see cref="FdbMutationType.VersionStampedKey"/> or <see cref="FdbMutationType.VersionStampedValue"/> mutations</returns>
337
+
/// <remarks>
338
+
/// The generate placeholder will use a random value that is unique per transaction (and changes at reach retry).
339
+
/// If the key contains the exact 80-bit byte signature of this token, the corresponding location will be tagged and replaced with the actual VersionStamp at commit time.
340
+
/// If another part of the key contains (by random chance) the same exact byte sequence, then an error will be triggered, and hopefully the transaction will retry with another byte sequence.
/// <summary>Return a place-holder 96-bit VersionStamp with an attached user version, whose value is not yet known, but will be filled by the database at commit time.</summary>
351
+
/// <returns>This value can used to generate temporary keys or value, for use with the <see cref="FdbMutationType.VersionStampedKey"/> or <see cref="FdbMutationType.VersionStampedValue"/> mutations</returns>
352
+
/// <remarks>
353
+
/// The generate placeholder will use a random value that is unique per transaction (and changes at reach retry).
354
+
/// If the key contains the exact 80-bit byte signature of this token, the corresponding location will be tagged and replaced with the actual VersionStamp at commit time.
355
+
/// If another part of the key contains (by random chance) the same exact byte sequence, then an error will be triggered, and hopefully the transaction will retry with another byte sequence.
356
+
/// </remarks>
357
+
public VersionStamp CreateVersionStamp(intuserVersion)
thrownew FdbException(FdbError.InvalidMutationType,"Atomic mutations for VersionStamps are only supported starting from API level 400. You need to select API level 400 or more at the start of your process.");
601
+
}
602
+
else
603
+
{
604
+
thrownew FdbException(FdbError.InvalidMutationType,"Atomic mutations Max and Min are only supported starting from client version 4.x. You need to update the version of the client, and select API level 400 or more at the start of your process..");
605
+
}
606
+
}
607
+
// ok!
608
+
return;
609
+
}
610
+
516
611
// this could be a new mutation type, or an invalid value.
517
612
thrownew FdbException(FdbError.InvalidMutationType,"An invalid mutation type was issued. If you are attempting to call a new mutation type, you will need to update the version of this assembly, and select the latest API level.");
/// <summary>Set the <paramref name="value"/> of the <paramref name="key"/> in the database, with the <see cref="VersionStamp"/> replaced by the resolved version at commit time.</summary>
462
+
/// <param name="trans">Transaction to use for the operation</param>
463
+
/// <param name="key">Name of the key whose value is to be mutated. This key must contain a single <see cref="VersionStamp"/>, whose position will be automatically detected.</param>
464
+
/// <param name="value">New value for this key.</param>
/// <summary>Set the <paramref name="value"/> of the <paramref name="key"/> in the database, with the <see cref="VersionStamp"/> replaced by the resolved version at commit time.</summary>
481
+
/// <param name="trans">Transaction to use for the operation</param>
482
+
/// <param name="key">Name of the key whose value is to be mutated. This key must contain a single <see cref="VersionStamp"/>, whose start is defined by <paramref name="stampOffset"/>.</param>
483
+
/// <param name="stampOffset">Offset within <paramref name="key"/> of the start of the 80-bit VersionStamp.</param>
484
+
/// <param name="value">New value for this key.</param>
/// <summary>Set the <paramref name="value"/> of the <paramref name="key"/> in the database, with the first 10 bytes overwritten with the transaction's <see cref="VersionStamp"/>.</summary>
500
+
/// <param name="trans">Transaction to use for the operation</param>
501
+
/// <param name="key">Name of the key whose value is to be mutated.</param>
502
+
/// <param name="value">Value whose first 10 bytes will be overwritten by the database with the resolved VersionStamp at commit time. The rest of the value will be untouched.</param>
Copy file name to clipboardExpand all lines: FoundationDB.Client/IFdbTransaction.cs
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,32 @@ public interface IFdbTransaction : IFdbReadOnlyTransaction
112
112
/// </remarks>
113
113
longGetCommittedVersion();
114
114
115
+
/// <summary>Returns the <see cref="VersionStamp"/> which was used by versionstamps operations in this transaction.</summary>
116
+
/// <remarks>
117
+
/// The Task will be ready only after the successful completion of a call to <see cref="CommitAsync"/> on this transaction.
118
+
/// Read-only transactions do not modify the database when committed and will result in the Task completing with an error.
119
+
/// Keep in mind that a transaction which reads keys and then sets them to their current values may be optimized to a read-only transaction.
120
+
/// </remarks>
121
+
Task<VersionStamp>GetVersionStampAsync();
122
+
123
+
/// <summary>Return a place-holder 80-bit VersionStamp, whose value is not yet known, but will be filled by the database at commit time.</summary>
124
+
/// <returns>This value can used to generate temporary keys or value, for use with the <see cref="FdbMutationType.VersionStampedKey"/> or <see cref="FdbMutationType.VersionStampedValue"/> mutations</returns>
125
+
/// <remarks>
126
+
/// The generate placeholder will use a random value that is unique per transaction (and changes at reach retry).
127
+
/// If the key contains the exact 80-bit byte signature of this token, the corresponding location will be tagged and replaced with the actual VersionStamp at commit time.
128
+
/// If another part of the key contains (by random chance) the same exact byte sequence, then an error will be triggered, and hopefully the transaction will retry with another byte sequence.
129
+
/// </remarks>
130
+
VersionStampCreateVersionStamp();
131
+
132
+
/// <summary>Return a place-holder 96-bit VersionStamp with an attached user version, whose value is not yet known, but will be filled by the database at commit time.</summary>
133
+
/// <returns>This value can used to generate temporary keys or value, for use with the <see cref="FdbMutationType.VersionStampedKey"/> or <see cref="FdbMutationType.VersionStampedValue"/> mutations</returns>
134
+
/// <remarks>
135
+
/// The generate placeholder will use a random value that is unique per transaction (and changes at reach retry).
136
+
/// If the key contains the exact 80-bit byte signature of this token, the corresponding location will be tagged and replaced with the actual VersionStamp at commit time.
137
+
/// If another part of the key contains (by random chance) the same exact byte sequence, then an error will be triggered, and hopefully the transaction will retry with another byte sequence.
0 commit comments