Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
217494a
The Commit Who Broke Your Code! (ノ゚0゚)ノ~
KrzysFR Nov 14, 2014
c466dfc
Added a few [DebuggerStepThrough] attributes to help going through te…
KrzysFR Nov 14, 2014
c675d54
Refactored the Tuple encoders to be able to properly escape embedded …
KrzysFR Nov 14, 2014
82000af
Organized projects using Solution Folders
KrzysFR Nov 16, 2014
31ff292
Continue Tuple API refactoring
KrzysFR Nov 16, 2014
5c9c980
Renamed location.Partition.By(...) to location.Partition.ByKey(...)
KrzysFR Nov 17, 2014
b6d3593
Tuple refactoring: object[] considered harmful
KrzysFR Nov 17, 2014
f8082d1
Tuple refactoring: trying to reduce the mess with CreateRange, Create…
KrzysFR Nov 17, 2014
962e4b3
Merge branch 'master' into refac_tuples
KrzysFR Nov 18, 2014
08763af
Subspace refactoring: moved ToRange() to the properties subspace.Keys…
KrzysFR Nov 18, 2014
9582300
Tuples: adding With(..) and OfSize(..) helpers
KrzysFR Nov 19, 2014
305281c
FdbTuple.FromArray used struct tuples for size 0 to 3
KrzysFR Nov 20, 2014
3e2700d
Tuples: added FdbTupleParser.BeginTuple() and EndTuple()
KrzysFR Nov 20, 2014
dd66b07
AsyncLinq: added Distinct(), MinAsync(), MaxAsync(), ElementAtAsync()…
KrzysFR Nov 21, 2014
5c0607d
AsyncLinq: added some [NotNull] and cleaned up spaces
KrzysFR Nov 21, 2014
567a34f
Refactored the way time is measured in FdbOperationContext
KrzysFR Nov 25, 2014
713b793
AsyncLINQ: refactoring to better handle composition of filters and tr…
KrzysFR Nov 25, 2014
8e18a5a
Fixed crash in FDBShell command 'count' if directory path not found
KrzysFR Nov 26, 2014
0e21656
AsyncLinq: better callstack
KrzysFR Nov 28, 2014
aa3a399
Renamed FdbEncoderSubspace<...>.EncodeKeyRange(...) to EncodeKeys(...)
KrzysFR Nov 28, 2014
1ae5996
Tupels: added an API for custom decoders to parse packed tuple segments
KrzysFR Nov 29, 2014
e731b98
AsyncHelpers: made some change to Maybe<T> and IAsyncTarget<T> to be …
KrzysFR Nov 29, 2014
b81821a
KeyValueEncoders: renamed all EncodeRange/DecodeRange to EncodeKeys/D…
KrzysFR Nov 29, 2014
e4c7a3f
Merge branch 'master' into refac_tuples
KrzysFR Nov 29, 2014
302fef9
Merge branch 'master' into refac_tuples
KrzysFR Nov 29, 2014
4c56b4c
Maybe<T>: more changes to keep the original error callstack untouched…
KrzysFR Dec 1, 2014
abf2574
Removed IFdbTransactional overrides on test layers
KrzysFR Dec 2, 2014
c53bc56
Renamed IFdbTransactional into IFdbRetryable and remove uneeded overr…
KrzysFR Dec 2, 2014
5ddec6e
Manuel merge between with master branch
KrzysFR Dec 2, 2014
f2652f8
Cleaned up the FdbEncoderSubspace
KrzysFR Dec 4, 2014
5bff32a
Merge branch 'master' into refac_tuples
KrzysFR Dec 4, 2014
33fa13a
Merge branch 'master' into refac_tuples
KrzysFR Dec 4, 2014
94ddab0
Tuples: fixed pretty print of Guids inside tuples
KrzysFR Dec 5, 2014
e5876f7
AsyncLINQ: finished port or OrderBy/ThenBy
KrzysFR Dec 7, 2014
6f2ac8e
Fix unit test after changes to Guid pretty printing in tuples
KrzysFR Dec 7, 2014
c1e314d
AsyncLINQ: fixed error handling when an interator is disposed at the …
gcastre Dec 8, 2014
4ae6536
Fixed invalid names in DebuggerDisplay attribute for FdbRangeQuery.Re…
KrzysFR Dec 8, 2014
8abf3cf
XML comments and code annotations
KrzysFR Dec 10, 2014
36612ce
Logging Filter: tweaked formatting of command and timing reports
KrzysFR Dec 10, 2014
0c319eb
Merge branch 'master' into refac_tuples
KrzysFR Dec 10, 2014
f0ff6bb
Merge branch 'master' into refac_tuples
KrzysFR Dec 11, 2014
1d4ad31
Fixed merge issue with new tuple api
KrzysFR Dec 11, 2014
636c1ca
Merge branch 'master' into refac_tuples
KrzysFR Dec 11, 2014
81e09ed
Fixed merge
KrzysFR Dec 11, 2014
854fbf0
Merge remote-tracking branch 'origin/master' into refac_tuples
KrzysFR Dec 12, 2014
04bc8ed
Merge branch 'master' into refac_tuples
KrzysFR Dec 12, 2014
c1af17a
Merge branch 'master' into refac_tuples
KrzysFR Dec 16, 2014
2923ecd
Reduced duration of test Test_Can_Bulk_Batched_Insert_Items()
KrzysFR Dec 16, 2014
175f2fa
Merge branch 'master' into refac_tuples
KrzysFR Dec 18, 2014
b80cc98
Merge branch 'master' into refac_tuples
KrzysFR Dec 19, 2014
f32ee91
Fix merge
KrzysFR Dec 19, 2014
5feba80
Merge branch 'master' into refac_tuples
KrzysFR Dec 22, 2014
f6aa96c
Merge branch 'master' into refac_tuples
KrzysFR Dec 24, 2014
f11bdfb
Merge branch 'master' into refac_tuples
KrzysFR Dec 30, 2014
d22264b
Merge branch 'master' into refac_tuples
KrzysFR Jan 15, 2015
186b999
Merge branch 'master' into refac_tuples
KrzysFR Jan 15, 2015
eb050f4
Ajount [InstantHandle] sur ExportAsync
alecocq Jan 16, 2015
6eb49dc
Merge branch 'master' into refac_tuples
KrzysFR Jan 17, 2015
10531c3
Merge branch 'master' into refac_tuples
KrzysFR Jan 19, 2015
e3b99f2
Merge branch 'master' into refac_tuples
KrzysFR Jan 26, 2015
7e33bb8
Reimpleted the mapping between Future handles and FdbFuture<T> classe…
KrzysFR Jan 27, 2015
6c3c00a
A bit of refactoring and cleanup
KrzysFR Jan 28, 2015
445a86c
Merge branch 'master' into refac_tuples
KrzysFR Jan 30, 2015
302d8e9
Fixed merge (new api)
KrzysFR Jan 30, 2015
4fb6090
Merge branch 'master' into refac_tuples
KrzysFR Jan 30, 2015
481a3ec
Tuples: preparing for switch bewteen FdbTuple.Unpack() and FdbTuple.U…
KrzysFR Feb 2, 2015
7d5597d
Tuples: chanded FdbTuple.Unpack() to throw on Slice.Nil (breaking!)
KrzysFR Feb 2, 2015
d33ae28
Tuples: cleaned up unused methods and fixed xml comments
KrzysFR Feb 2, 2015
da91433
Fix comment
gcastre Feb 3, 2015
2609a0c
The Great Subspace API Refactoring of 2015
KrzysFR Feb 5, 2015
0ab73cf
Merge branch 'master' into refac_tuples
KrzysFR Feb 5, 2015
6fe20e4
Merge branch 'refac_tuples' of git.doxense.local:Doxense/foundationdb…
KrzysFR Feb 5, 2015
11f13f9
Merge branch 'refac_tuples' into typesystem
KrzysFR Feb 5, 2015
1069e3c
Merge branch 'master' into refac_tuples
KrzysFR Feb 6, 2015
693a2a1
Merge branch 'refac_tuples' into typesystem
KrzysFR Feb 6, 2015
4678625
Introduced the notion of KeyEncoding and KeyEncoder
KrzysFR Feb 6, 2015
d1337da
Tuples: added FdbTuple.FromObjects and cleaned up FdbTuple.Wrap
KrzysFR Feb 9, 2015
659c57a
Tuples: added implicit and explicit conversion from and to BCL's Tupl…
KrzysFR Feb 9, 2015
a144098
Tuples: added FdbTuple.As<T1, .., TN>(..) extension methods
KrzysFR Feb 9, 2015
7d92d58
Tuples: added FdbTuple.Truncate(n) which returns the first n (or last…
KrzysFR Feb 9, 2015
532bee9
Tuples: add more tests on Truncate()
KrzysFR Feb 9, 2015
37e69a8
Added first version of documentation about Tuples API
KrzysFR Feb 9, 2015
9e32cbd
Continued work on Tuple API doc
KrzysFR Feb 9, 2015
8e0d8b6
Update Tuples.md
KrzysFR Feb 9, 2015
41d78af
Update Tuples.md
KrzysFR Feb 9, 2015
184d3c0
Merge branch 'refac_tuples' of https://github.com/Doxense/foundationd…
ajbeamon Feb 9, 2015
a38e791
Fix error code for invalid_mutation_type
ajbeamon Feb 9, 2015
f3666d0
Ignore .vs/ subfolder (VS 2105)
KrzysFR Feb 10, 2015
2a09699
Merge branch 'master' into refac_tuples
KrzysFR Feb 10, 2015
d9028e5
Merge pull request #52 from ajbeamon/master
KrzysFR Feb 10, 2015
9024f98
Merge branch 'master' into futures_ng
KrzysFR Feb 11, 2015
988df11
Moved future related files into a subfolder
KrzysFR Feb 11, 2015
6da27bd
Future handles are now back to an IntPtr so that can't be compared wi…
KrzysFR Feb 12, 2015
0b5ae13
Added #if DEBUG_FUTURES to on/off custom logging in all the future ca…
KrzysFR Feb 12, 2015
b030e29
Detect when the main future callback is not called from the network t…
KrzysFR Feb 13, 2015
940dade
Switched over to the refac_tuples branch
KrzysFR Feb 16, 2015
79552df
Added the CancellationToken.RegisterWithoutEC() hack to not pay the c…
KrzysFR Feb 16, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ $tf*/
nuget/
packages/
*.ide/
.vs/

fdb_c.dll

Expand Down
2 changes: 1 addition & 1 deletion FdbBurner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private static async Task BurnerThread(IFdbDatabase db, CancellationToken ct)
? rnd.Next()
: pos + i;

tr.Set(folder.Pack(x, Suffix), Value);
tr.Set(folder.Keys.Encode(x, Suffix), Value);
Interlocked.Increment(ref Keys);
}
pos += N;
Expand Down
22 changes: 11 additions & 11 deletions FdbShell/Commands/BasicCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ public static async Task Dir(string[] path, IFdbTuple extras, DirectoryBrowseOpt
{
if (!(subfolder is FdbDirectoryPartition))
{
long count = await Fdb.System.EstimateCountAsync(db, subfolder.ToRange(), ct);
log.WriteLine(" {0,-12} {1,-12} {3,9:N0} {2}", FdbKey.Dump(subfolder.Copy().Key), subfolder.Layer.IsNullOrEmpty ? "-" : ("<" + subfolder.Layer.ToUnicode() + ">"), name, count);
long count = await Fdb.System.EstimateCountAsync(db, subfolder.Keys.ToRange(), ct);
log.WriteLine(" {0,-12} {1,-12} {3,9:N0} {2}", FdbKey.Dump(FdbSubspace.Copy(subfolder).Key), subfolder.Layer.IsNullOrEmpty ? "-" : ("<" + subfolder.Layer.ToUnicode() + ">"), name, count);
}
else
{
log.WriteLine(" {0,-12} {1,-12} {3,9} {2}", FdbKey.Dump(subfolder.Copy().Key), subfolder.Layer.IsNullOrEmpty ? "-" : ("<" + subfolder.Layer.ToUnicode() + ">"), name, "-");
log.WriteLine(" {0,-12} {1,-12} {3,9} {2}", FdbKey.Dump(FdbSubspace.Copy(subfolder).Key), subfolder.Layer.IsNullOrEmpty ? "-" : ("<" + subfolder.Layer.ToUnicode() + ">"), name, "-");
}
}
else
{
log.WriteLine(" {0,-12} {1,-12} {2}", FdbKey.Dump(subfolder.Copy().Key), subfolder.Layer.IsNullOrEmpty ? "-" : ("<" + subfolder.Layer.ToUnicode() + ">"), name);
log.WriteLine(" {0,-12} {1,-12} {2}", FdbKey.Dump(FdbSubspace.Copy(subfolder).Key), subfolder.Layer.IsNullOrEmpty ? "-" : ("<" + subfolder.Layer.ToUnicode() + ">"), name);
}
}
else
Expand Down Expand Up @@ -115,7 +115,7 @@ public static async Task CreateDirectory(string[] path, IFdbTuple extras, IFdbDa
log.WriteLine("- Created under {0} [{1}]", FdbKey.Dump(folder.Key), folder.Key.ToHexaString(' '));

// look if there is already stuff under there
var stuff = await db.ReadAsync((tr) => tr.GetRange(folder.ToRange()).FirstOrDefaultAsync(), cancellationToken: ct);
var stuff = await db.ReadAsync((tr) => tr.GetRange(folder.Keys.ToRange()).FirstOrDefaultAsync(), cancellationToken: ct);
if (stuff.Key.IsPresent)
{
log.WriteLine("CAUTION: There is already some data under {0} !");
Expand Down Expand Up @@ -216,7 +216,7 @@ public static async Task Count(string[] path, IFdbTuple extras, IFdbDatabase db,
return;
}

var copy = folder.Copy();
var copy = FdbSubspace.Copy(folder);
log.WriteLine("# Counting keys under {0} ...", FdbKey.Dump(copy.Key));

var progress = new Progress<FdbTuple<long, Slice>>((state) =>
Expand Down Expand Up @@ -245,7 +245,7 @@ public static async Task Show(string[] path, IFdbTuple extras, bool reverse, IFd
log.WriteLine("# Content of {0} [{1}]", FdbKey.Dump(folder.Key), folder.Key.ToHexaString(' '));
var keys = await db.QueryAsync((tr) =>
{
var query = tr.GetRange(folder.ToRange());
var query = tr.GetRange(folder.Keys.ToRange());
return reverse
? query.Reverse().Take(count)
: query.Take(count + 1);
Expand All @@ -255,7 +255,7 @@ public static async Task Show(string[] path, IFdbTuple extras, bool reverse, IFd
if (reverse) keys.Reverse();
foreach (var key in keys.Take(count))
{
log.WriteLine("...{0} = {1}", FdbKey.Dump(folder.Extract(key.Key)), key.Value.ToAsciiOrHexaString());
log.WriteLine("...{0} = {1}", FdbKey.Dump(folder.ExtractKey(key.Key)), key.Value.ToAsciiOrHexaString());
}
if (!reverse && keys.Count == count + 1)
{
Expand Down Expand Up @@ -329,7 +329,7 @@ public static async Task Map(string[] path, IFdbTuple extras, IFdbDatabase db, T
return;
}

var span = folder.DirectoryLayer.ContentSubspace.ToRange();
var span = folder.DirectoryLayer.ContentSubspace.Keys.ToRange();

// note: this may break in future versions of the DL! Maybe we need a custom API to get a flat list of all directories in a DL that span a specific range ?

Expand Down Expand Up @@ -554,7 +554,7 @@ public static async Task Shards(string[] path, IFdbTuple extras, IFdbDatabase db
var folder = (await TryOpenCurrentDirectoryAsync(path, db, ct)) as FdbDirectorySubspace;
if (folder != null)
{
var r = FdbKeyRange.StartsWith(folder.Copy().Key);
var r = FdbKeyRange.StartsWith(FdbSubspace.Copy(folder).Key);
Console.WriteLine("Searching for shards that intersect with /{0} ...", String.Join("/", path));
ranges = await Fdb.System.GetChunksAsync(db, r, ct);
Console.WriteLine("Found {0} ranges intersecting {1}:", ranges.Count, r);
Expand Down Expand Up @@ -589,7 +589,7 @@ public static async Task Sampling(string[] path, IFdbTuple extras, IFdbDatabase
FdbKeyRange span;
if (folder is FdbDirectorySubspace)
{
span = FdbKeyRange.StartsWith((folder as FdbDirectorySubspace).Copy());
span = FdbKeyRange.StartsWith(FdbSubspace.Copy(folder as FdbDirectorySubspace).Key);
log.WriteLine("Reading list of shards for /{0} under {1} ...", String.Join("/", path), FdbKey.Dump(span.Begin));
}
else
Expand Down
2 changes: 1 addition & 1 deletion FdbShell/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private static async Task MainAsync(string[] args, CancellationToken cancel)
var tokens = s.Trim().Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string cmd = tokens.Length > 0 ? tokens[0] : String.Empty;
string prm = tokens.Length > 1 ? tokens[1] : String.Empty;
var extras = tokens.Length > 2 ? FdbTuple.CreateRange<string>(tokens.Skip(2)) : FdbTuple.Empty;
var extras = tokens.Length > 2 ? FdbTuple.FromEnumerable<string>(tokens.Skip(2)) : FdbTuple.Empty;

var trimmedCommand = cmd.Trim().ToLowerInvariant();
switch (trimmedCommand)
Expand Down
5 changes: 5 additions & 0 deletions FoundationDB.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FdbTop", "FdbTop\FdbTop.csp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FdbBurner", "FdbBurner\FdbBurner.csproj", "{60049BA1-A95F-4127-BAC5-74AF023D3082}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documents", "Documents", "{1B6BEB71-8C92-4B06-9715-9DAF49907BA1}"
ProjectSection(SolutionItems) = preProject
Tuples.md = Tuples.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
6 changes: 3 additions & 3 deletions FoundationDB.Client/Async/AsyncCancellableMutex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public AsyncCancelableMutex(CancellationToken ct)
{
if (ct.CanBeCanceled)
{
m_ctr = ct.Register(s_cancellationCallback, new WeakReference<AsyncCancelableMutex>(this), useSynchronizationContext: false);
m_ctr = ct.RegisterWithoutEC(s_cancellationCallback, new WeakReference<AsyncCancelableMutex>(this));
}
GC.SuppressFinalize(this);
}
Expand Down Expand Up @@ -130,12 +130,12 @@ public bool Abort(bool async = false)

private static void SetDefered(AsyncCancelableMutex mutex)
{
ThreadPool.QueueUserWorkItem((state) => ((AsyncCancelableMutex)state).TrySetResult(null), mutex);
ThreadPool.UnsafeQueueUserWorkItem((state) => ((AsyncCancelableMutex)state).TrySetResult(null), mutex);
}

private static void CancelDefered(AsyncCancelableMutex mutex)
{
ThreadPool.QueueUserWorkItem((state) => ((AsyncCancelableMutex)state).TrySetCanceled(), mutex);
ThreadPool.UnsafeQueueUserWorkItem((state) => ((AsyncCancelableMutex)state).TrySetCanceled(), mutex);
}

}
Expand Down
30 changes: 30 additions & 0 deletions FoundationDB.Client/Async/TaskHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,36 @@ public static void Observe(Task task)
}
}

private delegate CancellationTokenRegistration RegisterWithoutECDelegate(ref CancellationToken ct, Action<object> callback, object state);
private static readonly RegisterWithoutECDelegate RegisterWithoutECHandler = GetRegisterWithoutECDelegate();

[NotNull]
private static RegisterWithoutECDelegate GetRegisterWithoutECDelegate()
{
try
{
// CancellationToken.Register(..., useExecutionContext) is "private", and all the public version of Register pass true, which does costly allocations (capturing context, ...)
// There is however CancellationToken.InternalRegisterWithoutEC which is internal and pass false.
// => we will attempt to create a delegate to call the internal method - if possible - or fallback to the default version of Register, if this is not possible.
var method = typeof(CancellationToken).GetMethod("InternalRegisterWithoutEC", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, new[] { typeof(Action<object>), typeof(object) }, null);
if (method != null)
{
return (RegisterWithoutECDelegate)Delegate.CreateDelegate(typeof(RegisterWithoutECDelegate), null, method);
}
}
catch
{ }

return (ref CancellationToken token, Action<object> callback, object state) => token.Register(callback, state);
}

/// <summary>Version of CancellationToken.Register() that does not propagate the current ExecutionContext to the callback (faster, but unsafe!)</summary>
/// <remarks>This should only be used with callbacks that do not execute user-provided code!</remarks>
internal static CancellationTokenRegistration RegisterWithoutEC(this CancellationToken ct, [NotNull] Action<object> callback, object state)
{
return RegisterWithoutECHandler(ref ct, callback, state);
}

/// <summary>Safely cancel a CancellationTokenSource</summary>
/// <param name="source">CancellationTokenSource that needs to be cancelled</param>
public static void SafeCancel(this CancellationTokenSource source)
Expand Down
35 changes: 18 additions & 17 deletions FoundationDB.Client/Core/IFdbTransactionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public interface IFdbTransactionHandler : IDisposable
void SetOption(FdbTransactionOption option, Slice data);

/// <summary>Returns this transaction snapshot read version.</summary>
Task<long> GetReadVersionAsync(CancellationToken cancellationToken);
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
Task<long> GetReadVersionAsync(CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Retrieves the database version number at which a given transaction was committed.</summary>
/// <remarks>CommitAsync() must have been called on this transaction and the resulting task must have completed successfully before this function is callged, or the behavior is undefined.
Expand All @@ -71,46 +72,46 @@ public interface IFdbTransactionHandler : IDisposable
/// <summary>Reads a get from the database</summary>
/// <param name="key">Key to read</param>
/// <param name="snapshot">Set to true for snapshot reads</param>
/// <param name="cancellationToken"></param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns></returns>
Task<Slice> GetAsync(Slice key, bool snapshot, CancellationToken cancellationToken);
Task<Slice> GetAsync(Slice key, bool snapshot, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Reads several values from the database snapshot represented by the current transaction</summary>
/// <param name="keys">Keys to be looked up in the database</param>
/// <param name="snapshot">Set to true for snapshot reads</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns>Task that will return an array of values, or an exception. Each item in the array will contain the value of the key at the same index in <paramref name="keys"/>, or Slice.Nil if that key does not exist.</returns>
Task<Slice[]> GetValuesAsync([NotNull] Slice[] keys, bool snapshot, CancellationToken cancellationToken);
Task<Slice[]> GetValuesAsync([NotNull] Slice[] keys, bool snapshot, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Resolves a key selector against the keys in the database snapshot represented by the current transaction.</summary>
/// <param name="selector">Key selector to resolve</param>
/// <param name="snapshot">Set to true for snapshot reads</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns>Task that will return the key matching the selector, or an exception</returns>
Task<Slice> GetKeyAsync(FdbKeySelector selector, bool snapshot, CancellationToken cancellationToken);
Task<Slice> GetKeyAsync(FdbKeySelector selector, bool snapshot, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Resolves several key selectors against the keys in the database snapshot represented by the current transaction.</summary>
/// <param name="selectors">Key selectors to resolve</param>
/// <param name="snapshot">Set to true for snapshot reads</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns>Task that will return an array of keys matching the selectors, or an exception</returns>
Task<Slice[]> GetKeysAsync([NotNull] FdbKeySelector[] selectors, bool snapshot, CancellationToken cancellationToken);
Task<Slice[]> GetKeysAsync([NotNull] FdbKeySelector[] selectors, bool snapshot, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Reads all key-value pairs in the database snapshot represented by transaction (potentially limited by Limit, TargetBytes, or Mode) which have a key lexicographically greater than or equal to the key resolved by the begin key selector and lexicographically less than the key resolved by the end key selector.</summary>
/// <param name="beginInclusive">key selector defining the beginning of the range</param>
/// <param name="endExclusive">key selector defining the end of the range</param>
/// <param name="options">Optionnal query options (Limit, TargetBytes, Mode, Reverse, ...)</param>
/// <param name="iteration">If streaming mode is FdbStreamingMode.Iterator, this parameter should start at 1 and be incremented by 1 for each successive call while reading this range. In all other cases it is ignored.</param>
/// <param name="snapshot">Set to true for snapshot reads</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns></returns>
Task<FdbRangeChunk> GetRangeAsync(FdbKeySelector beginInclusive, FdbKeySelector endExclusive, [NotNull] FdbRangeOptions options, int iteration, bool snapshot, CancellationToken cancellationToken);
Task<FdbRangeChunk> GetRangeAsync(FdbKeySelector beginInclusive, FdbKeySelector endExclusive, [NotNull] FdbRangeOptions options, int iteration, bool snapshot, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Returns a list of public network addresses as strings, one for each of the storage servers responsible for storing <paramref name="key"/> and its associated value</summary>
/// <param name="key">Name of the key whose location is to be queried.</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns>Task that will return an array of strings, or an exception</returns>
Task<string[]> GetAddressesForKeyAsync(Slice key, CancellationToken cancellationToken);
Task<string[]> GetAddressesForKeyAsync(Slice key, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Modify the database snapshot represented by transaction to change the given key to have the given value. If the given key was not previously present in the database it is inserted.
/// The modification affects the actual database only if transaction is later committed with CommitAsync().
Expand Down Expand Up @@ -153,19 +154,19 @@ public interface IFdbTransactionHandler : IDisposable
/// The commit may or may not succeed – in particular, if a conflicting transaction previously committed, then the commit must fail in order to preserve transactional isolation.
/// If the commit does succeed, the transaction is durably committed to the database and all subsequently started transactions will observe its effects.
/// </summary>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns>Task that succeeds if the transaction was comitted successfully, or fails if the transaction failed to commit.</returns>
/// <remarks>As with other client/server databases, in some failure scenarios a client may be unable to determine whether a transaction succeeded. In these cases, CommitAsync() will throw CommitUnknownResult error. The OnErrorAsync() function treats this error as retryable, so retry loops that don’t check for CommitUnknownResult could execute the transaction twice. In these cases, you must consider the idempotence of the transaction.</remarks>
Task CommitAsync(CancellationToken cancellationToken);
Task CommitAsync(CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Implements the recommended retry and backoff behavior for a transaction.
/// This function knows which of the error codes generated by other query functions represent temporary error conditions and which represent application errors that should be handled by the application.
/// It also implements an exponential backoff strategy to avoid swamping the database cluster with excessive retries when there is a high level of conflict between transactions.
/// </summary>
/// <param name="code">FdbError code thrown by the previous command</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside</param>
/// <param name="cancellationToken">Token used to cancel the operation from the outside, if different than the cancellation token of the transaction itself</param>
/// <returns>Returns a task that completes if the operation can be safely retried, or that rethrows the original exception if the operation is not retryable.</returns>
Task OnErrorAsync(FdbError code, CancellationToken cancellationToken);
Task OnErrorAsync(FdbError code, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>Reset transaction to its initial state.</summary>
/// <remarks>This is similar to disposing the transaction and recreating a new one. The only state that persists through a transaction reset is that which is related to the backoff logic used by OnErrorAsync()</remarks>
Expand Down
Loading