diff --git a/Core.Arango.Tests/LinqTest_BasicOperations.cs b/Core.Arango.Tests/LinqTest_BasicOperations.cs index 46d68ebb63..8e96fa191c 100644 --- a/Core.Arango.Tests/LinqTest_BasicOperations.cs +++ b/Core.Arango.Tests/LinqTest_BasicOperations.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; using System.Linq; using System.Threading.Tasks; using Core.Arango.Protocol; @@ -46,14 +44,9 @@ class InnerChain public string F { get; set; } } - public class LinqTest_BasicOperations : TestBase + public class LinqTest_BasicOperations(ITestOutputHelper output) : TestBase { private const string D = "test"; - private readonly ITestOutputHelper _output; - public LinqTest_BasicOperations(ITestOutputHelper output) - { - _output = output; - } [Fact] public void Any() @@ -81,7 +74,7 @@ public async Task GroupBy() var result = await q.ToListAsync(); - _output.WriteLine(q.ToAql().aql); + output.WriteLine(q.ToAql().aql); } /*[Fact] @@ -192,7 +185,7 @@ public async Task Count_In_Filter() var q = Arango.Query("test") .Where(x => x.Notes.Count() == 3); - _output.WriteLine(q.ToAql().aql); + output.WriteLine(q.ToAql().aql); var activities = await q.ToListAsync(); @@ -205,7 +198,7 @@ public async Task Count_In_Select() var q = Arango.Query("test") .Select(x => x.Notes.Count()); - _output.WriteLine(q.ToAql().aql); + output.WriteLine(q.ToAql().aql); var activitiesNotesCount = await q.ToListAsync(); @@ -227,7 +220,7 @@ public async Task Contains() { var p = await Arango.Query("test").FirstOrDefaultAsync(); - _output.WriteLine(JsonConvert.SerializeObject(p)); + output.WriteLine(JsonConvert.SerializeObject(p)); var boolean = Arango.Query("test").Contains(p); // This should work: does `p` not get serialized the same way is it gets de-serialized? This operations should be inverse of each other. @@ -283,7 +276,7 @@ public async Task Except_Compare_Keys() .Select(x => x.Key) .Except(list); - PrintQuery(q, _output); + PrintQuery(q, output); var p = await q.ToListAsync(); @@ -298,7 +291,7 @@ public async Task Combine_Skip_Take() .Take(1) .Select(x => x.Key); - PrintQuery(q, _output); + PrintQuery(q, output); var p = await q.ToListAsync(); @@ -357,8 +350,8 @@ public async Task Union() var aql = q.ToAql(); - _output.WriteLine(aql.aql); - _output.WriteLine(JsonConvert.SerializeObject(aql.bindVars)); + output.WriteLine(aql.aql); + output.WriteLine(JsonConvert.SerializeObject(aql.bindVars)); var p = await q.ToListAsync(); diff --git a/Core.Arango.Tests/LinqTest_String.cs b/Core.Arango.Tests/LinqTest_String.cs index a7726a3d22..bf2ebd3edc 100644 --- a/Core.Arango.Tests/LinqTest_String.cs +++ b/Core.Arango.Tests/LinqTest_String.cs @@ -1,26 +1,18 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; using System.Linq; using System.Threading.Tasks; using Core.Arango.Protocol; using Core.Arango.Linq; using Core.Arango.Tests.Core; -using Newtonsoft.Json; using Xunit; using Xunit.Abstractions; namespace Core.Arango.Tests { - public class LinqTest_String : TestBase + public class LinqTest_String(ITestOutputHelper output) : TestBase { private const string D = "test"; - private readonly ITestOutputHelper _output; - public LinqTest_String(ITestOutputHelper output) - { - _output = output; - } [Fact] public async Task StringConcat() @@ -201,8 +193,8 @@ public async Task StringSubstring() Assert.Equal("Project A", p1.Name); Assert.Equal("Project A", p2.Name); - _output.WriteLine(q1.ToAql().aql); - _output.WriteLine(q2.ToAql().aql); + output.WriteLine(q1.ToAql().aql); + output.WriteLine(q2.ToAql().aql); } [Fact] @@ -212,7 +204,7 @@ public async Task StringToLower() var p = await q.FirstOrDefaultAsync(); Assert.Equal("Project A", p.Name); - _output.WriteLine(q.ToAql().aql); + output.WriteLine(q.ToAql().aql); } [Fact] @@ -222,7 +214,7 @@ public async Task StringToUpper() var p = await q.FirstOrDefaultAsync(); Assert.Equal("Project A", p.Name); - _output.WriteLine(q.ToAql().aql); + output.WriteLine(q.ToAql().aql); } public override async Task InitializeAsync() diff --git a/Core.Arango.Tests/QueryStatisticTest.cs b/Core.Arango.Tests/QueryStatisticTest.cs index 2ab326ba37..2a1c0f75bb 100644 --- a/Core.Arango.Tests/QueryStatisticTest.cs +++ b/Core.Arango.Tests/QueryStatisticTest.cs @@ -9,15 +9,8 @@ namespace Core.Arango.Tests { - public class QueryStatisticTest : TestBase + public class QueryStatisticTest(ITestOutputHelper output) : TestBase { - private readonly ITestOutputHelper _output; - - public QueryStatisticTest(ITestOutputHelper output) - { - _output = output; - } - public override async Task InitializeAsync() { Arango = @@ -31,7 +24,7 @@ public override async Task InitializeAsync() foreach (var p in bindVars.OrderByDescending(x => x.Key.Length)) boundQuery = boundQuery.Replace("@" + p.Key, JsonConvert.SerializeObject(p.Value)); - _output.WriteLine( + output.WriteLine( $"{boundQuery}\n{JsonConvert.SerializeObject(stats, Formatting.Indented)}"); } }); diff --git a/Core.Arango.Tests/TransactionTest.cs b/Core.Arango.Tests/TransactionTest.cs index 470fd6fb32..f1523cf2b3 100644 --- a/Core.Arango.Tests/TransactionTest.cs +++ b/Core.Arango.Tests/TransactionTest.cs @@ -110,7 +110,7 @@ public async Task StreamTransactionQuery(string serializer) Assert.Equal(3, (await Arango.Query.FindAsync("test", "test", $"true")).Count); var exception = - await Assert.ThrowsAsync(() => Arango.Query.FindAsync(t2, "test", $"true")); + await Assert.ThrowsAsync(() => Arango.Query.FindAsync(t2, "test", $"true").AsTask()); Assert.NotNull(exception.ErrorNumber); Assert.NotNull(exception.Code); diff --git a/Core.Arango/ArangoContext.cs b/Core.Arango/ArangoContext.cs index 76d7a54b0c..78345428d9 100644 --- a/Core.Arango/ArangoContext.cs +++ b/Core.Arango/ArangoContext.cs @@ -110,7 +110,7 @@ public ArangoContext(string cs, IArangoConfiguration settings = null) public IArangoPregelModule Pregel { get; } /// - public async Task GetVersionAsync(CancellationToken cancellationToken = default) + public async ValueTask GetVersionAsync(CancellationToken cancellationToken = default) { var res = await Configuration.Transport.SendAsync(HttpMethod.Get, "/_db/_system/_api/version", @@ -123,7 +123,7 @@ public async Task GetVersionAsync(CancellationToken cancellationT } /// - public async Task> GetEndpointsAsync(CancellationToken cancellationToken = default) + public async ValueTask> GetEndpointsAsync(CancellationToken cancellationToken = default) { var res = await Configuration.Transport.SendAsync(HttpMethod.Get, "/_api/cluster/endpoints", cancellationToken: cancellationToken); diff --git a/Core.Arango/IArangoContext.cs b/Core.Arango/IArangoContext.cs index 9104fb1eba..6f79f91ef6 100644 --- a/Core.Arango/IArangoContext.cs +++ b/Core.Arango/IArangoContext.cs @@ -90,11 +90,11 @@ public interface IArangoContext /// /// Get Arango server version and license /// - Task GetVersionAsync(CancellationToken cancellationToken = default); + ValueTask GetVersionAsync(CancellationToken cancellationToken = default); /// /// Get Arango cluster endpoints /// - Task> GetEndpointsAsync(CancellationToken cancellationToken = default); + ValueTask> GetEndpointsAsync(CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Linq/ArangoQueryExtensions.cs b/Core.Arango/Linq/ArangoQueryExtensions.cs index 8a6f819955..f893417d11 100644 --- a/Core.Arango/Linq/ArangoQueryExtensions.cs +++ b/Core.Arango/Linq/ArangoQueryExtensions.cs @@ -51,29 +51,29 @@ public static (string aql, IDictionary bindVars) ToAql(this I return (data.Query.Trim(), data.BindVars); } - public static Task FirstAsync(this IQueryable source, CancellationToken cancellationToken = default) + public static ValueTask FirstAsync(this IQueryable source, CancellationToken cancellationToken = default) { return FirstOrDefaultAsync(source, false, null, cancellationToken); } - public static Task FirstAsync(this IQueryable source, + public static ValueTask FirstAsync(this IQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { return FirstOrDefaultAsync(source, false, predicate, cancellationToken); } - public static Task FirstOrDefaultAsync(this IQueryable source, CancellationToken cancellationToken = default) + public static ValueTask FirstOrDefaultAsync(this IQueryable source, CancellationToken cancellationToken = default) { return FirstOrDefaultAsync(source, true, null, cancellationToken); } - public static Task FirstOrDefaultAsync(this IQueryable source, + public static ValueTask FirstOrDefaultAsync(this IQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { return FirstOrDefaultAsync(source, true, predicate, cancellationToken); } - private static Task FirstOrDefaultAsync(this IQueryable source, bool returnDefaultWhenEmpty, + private static ValueTask FirstOrDefaultAsync(this IQueryable source, bool returnDefaultWhenEmpty, Expression> predicate, CancellationToken cancellationToken = default) { if (predicate != null) @@ -85,29 +85,29 @@ private static Task FirstOrDefaultAsync(this IQueryable source, bool re : source.AsArangoQueryable().FirstAsync(cancellationToken); } - public static Task SingleAsync(this IQueryable source, CancellationToken cancellationToken = default) + public static ValueTask SingleAsync(this IQueryable source, CancellationToken cancellationToken = default) { return SingleOrDefaultAsync(source, false, null, cancellationToken); } - public static Task SingleAsync(this IQueryable source, + public static ValueTask SingleAsync(this IQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { return SingleOrDefaultAsync(source, false, predicate, cancellationToken); } - public static Task SingleOrDefaultAsync(this IQueryable source, CancellationToken cancellationToken = default) + public static ValueTask SingleOrDefaultAsync(this IQueryable source, CancellationToken cancellationToken = default) { return SingleOrDefaultAsync(source, true, null, cancellationToken); } - public static Task SingleOrDefaultAsync(this IQueryable source, + public static ValueTask SingleOrDefaultAsync(this IQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { return SingleOrDefaultAsync(source, true, predicate, cancellationToken); } - private static Task SingleOrDefaultAsync(this IQueryable source, bool returnDefaultWhenEmpty, + private static ValueTask SingleOrDefaultAsync(this IQueryable source, bool returnDefaultWhenEmpty, Expression> predicate, CancellationToken cancellationToken = default) { if (predicate != null) @@ -119,7 +119,7 @@ private static Task SingleOrDefaultAsync(this IQueryable source, bool r : source.AsArangoQueryable().SingleAsync(cancellationToken); } - public static Task> ToListAsync(this IQueryable source, CancellationToken cancellationToken = default) + public static ValueTask> ToListAsync(this IQueryable source, CancellationToken cancellationToken = default) { return source.AsArangoQueryable().ToListAsync(cancellationToken); } diff --git a/Core.Arango/Linq/Interface/IArangoLinq.cs b/Core.Arango/Linq/Interface/IArangoLinq.cs index da627cf38f..a0cffa9f12 100644 --- a/Core.Arango/Linq/Interface/IArangoLinq.cs +++ b/Core.Arango/Linq/Interface/IArangoLinq.cs @@ -11,6 +11,6 @@ internal interface IArangoLinq public string ResolvePropertyName(Type t, string s); public string ResolveCollectionName(Type t); public IAsyncEnumerable StreamAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default); - public Task> ExecuteAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default); + public ValueTask> ExecuteAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Linq/Internal/ArangoLinq.cs b/Core.Arango/Linq/Internal/ArangoLinq.cs index 9c27340ba7..4e0855a3b8 100644 --- a/Core.Arango/Linq/Internal/ArangoLinq.cs +++ b/Core.Arango/Linq/Internal/ArangoLinq.cs @@ -34,7 +34,7 @@ public IAsyncEnumerable StreamAsync(string query, IDictionary(_handle, query, bindVars, cancellationToken: cancellationToken); } - public async Task> ExecuteAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default) + public async ValueTask> ExecuteAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default) { return await _context.Query.ExecuteAsync(_handle, query, bindVars, cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/Core.Arango/Linq/Query/ArangoQueryable.cs b/Core.Arango/Linq/Query/ArangoQueryable.cs index acd9ac61ff..2171ef46a4 100644 --- a/Core.Arango/Linq/Query/ArangoQueryable.cs +++ b/Core.Arango/Linq/Query/ArangoQueryable.cs @@ -29,34 +29,34 @@ public ArangoQueryable(IQueryProvider provider, Expression expression, IArangoLi this.db = db; } - public async Task> ToListAsync(CancellationToken cancellationToken = default) + public async ValueTask> ToListAsync(CancellationToken cancellationToken = default) { var data = GetQueryData(); return await db.ExecuteAsync(data.Query, data.BindVars, cancellationToken).ConfigureAwait(false); } - public async Task SingleOrDefaultAsync(CancellationToken cancellationToken = default) + public async ValueTask SingleOrDefaultAsync(CancellationToken cancellationToken = default) { var data = GetQueryData(); var list = await db.ExecuteAsync(data.Query, data.BindVars, cancellationToken).ConfigureAwait(false); return list.SingleOrDefault(); } - public async Task SingleAsync(CancellationToken cancellationToken = default) + public async ValueTask SingleAsync(CancellationToken cancellationToken = default) { var data = GetQueryData(); var list = await db.ExecuteAsync(data.Query, data.BindVars, cancellationToken).ConfigureAwait(false); return list.Single(); } - public async Task FirstOrDefaultAsync(CancellationToken cancellationToken = default) + public async ValueTask FirstOrDefaultAsync(CancellationToken cancellationToken = default) { var data = GetQueryData(); var list = await db.ExecuteAsync(data.Query, data.BindVars, cancellationToken).ConfigureAwait(false); return list.FirstOrDefault(); } - public async Task FirstAsync(CancellationToken cancellationToken = default) + public async ValueTask FirstAsync(CancellationToken cancellationToken = default) { var data = GetQueryData(); var list = await db.ExecuteAsync(data.Query, data.BindVars, cancellationToken).ConfigureAwait(false); diff --git a/Core.Arango/Modules/IArangoAnalyzerModule.cs b/Core.Arango/Modules/IArangoAnalyzerModule.cs index 29d7249da0..1d0a35d922 100644 --- a/Core.Arango/Modules/IArangoAnalyzerModule.cs +++ b/Core.Arango/Modules/IArangoAnalyzerModule.cs @@ -13,7 +13,7 @@ public interface IArangoAnalyzerModule /// /// creates a new Analyzer based on the provided definition /// - Task CreateAsync(ArangoHandle database, ArangoAnalyzer analyzer, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoHandle database, ArangoAnalyzer analyzer, CancellationToken cancellationToken = default); /// /// removes an Analyzer configuration @@ -22,19 +22,19 @@ public interface IArangoAnalyzerModule /// The name of the Analyzer to remove. /// The Analyzer configuration should be removed even if it is in-use. The default value is false. /// - Task DeleteAsync(ArangoHandle database, string analyzer, bool force = false, + ValueTask DeleteAsync(ArangoHandle database, string analyzer, bool force = false, CancellationToken cancellationToken = default); /// /// returns a listing of available Analyzer definitions /// - Task> ListAsync(ArangoHandle database, + ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// returns an Analyzer definition /// - Task GetDefinitionAsync(ArangoHandle database, string analyzer, + ValueTask GetDefinitionAsync(ArangoHandle database, string analyzer, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoBackupModule.cs b/Core.Arango/Modules/IArangoBackupModule.cs index 6a96e20868..9f0225fc07 100644 --- a/Core.Arango/Modules/IArangoBackupModule.cs +++ b/Core.Arango/Modules/IArangoBackupModule.cs @@ -13,21 +13,21 @@ public interface IArangoBackupModule /// /// Creates a local backup. /// - Task CreateAsync(ArangoBackupRequest request, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoBackupRequest request, CancellationToken cancellationToken = default); /// /// Restores from a local backup. /// - Task RestoreAsync(string id, CancellationToken cancellationToken = default); + ValueTask RestoreAsync(string id, CancellationToken cancellationToken = default); /// /// Delete a specific local backup. /// - Task DeleteAsync(string id, CancellationToken cancellationToken = default); + ValueTask DeleteAsync(string id, CancellationToken cancellationToken = default); /// /// List all local backups. /// - Task> ListAsync(string id = null, CancellationToken cancellationToken = default); + ValueTask> ListAsync(string id = null, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoCollectionModule.cs b/Core.Arango/Modules/IArangoCollectionModule.cs index 9f33ae4423..e3c16dd4ed 100644 --- a/Core.Arango/Modules/IArangoCollectionModule.cs +++ b/Core.Arango/Modules/IArangoCollectionModule.cs @@ -13,67 +13,67 @@ public interface IArangoCollectionModule /// /// Creates a collection /// - Task CreateAsync(ArangoHandle database, ArangoCollection collection, + ValueTask CreateAsync(ArangoHandle database, ArangoCollection collection, CancellationToken cancellationToken = default); /// /// Creates a collection /// - Task CreateAsync(ArangoHandle database, string collection, ArangoCollectionType type, + ValueTask CreateAsync(ArangoHandle database, string collection, ArangoCollectionType type, CancellationToken cancellationToken = default); /// /// Returns all collections /// - Task> ListAsync(ArangoHandle database, + ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// Renames a collection (not in cluster) /// - Task RenameAsync(ArangoHandle database, string oldname, string newname, + ValueTask RenameAsync(ArangoHandle database, string oldname, string newname, CancellationToken cancellationToken = default); /// /// Truncates a collection /// - Task TruncateAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); + ValueTask TruncateAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); /// /// Changes a collection /// - Task UpdateAsync(ArangoHandle database, string collection, ArangoCollectionUpdate update, + ValueTask UpdateAsync(ArangoHandle database, string collection, ArangoCollectionUpdate update, CancellationToken cancellationToken = default); /// /// Drops a collection /// /// - Task DropAsync(ArangoHandle database, string collection, + ValueTask DropAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); /// /// Returns a collection /// - Task GetAsync(ArangoHandle database, string collection, + ValueTask GetAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); /// /// Checks of collection exists (calls ListAsync internally) /// - Task ExistAsync(ArangoHandle database, string collection, + ValueTask ExistAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); /// /// Compacts the data of a collection in order to reclaim disk space /// - Task CompactAsync(ArangoHandle database, string collection, + ValueTask CompactAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); /// /// Recalculates the document count of a collection, if it ever becomes inconsistent. /// - Task RecalculateCountAsync(ArangoHandle database, string collection, + ValueTask RecalculateCountAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoDatabaseModule.cs b/Core.Arango/Modules/IArangoDatabaseModule.cs index 1f69a3de06..209ede9621 100644 --- a/Core.Arango/Modules/IArangoDatabaseModule.cs +++ b/Core.Arango/Modules/IArangoDatabaseModule.cs @@ -13,31 +13,31 @@ public interface IArangoDatabaseModule /// /// Creates a new database /// - Task CreateAsync(ArangoHandle name, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoHandle name, CancellationToken cancellationToken = default); /// /// Creates a new database with options /// - Task CreateAsync(ArangoDatabase database, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoDatabase database, CancellationToken cancellationToken = default); /// /// Retrieves information about the current database /// - Task GetAsync(ArangoHandle handle, CancellationToken cancellationToken = default); + ValueTask GetAsync(ArangoHandle handle, CancellationToken cancellationToken = default); /// /// Drop an existing database /// - Task DropAsync(ArangoHandle name, CancellationToken cancellationToken = default); + ValueTask DropAsync(ArangoHandle name, CancellationToken cancellationToken = default); /// /// Checks if database exists /// - Task ExistAsync(ArangoHandle name, CancellationToken cancellationToken = default); + ValueTask ExistAsync(ArangoHandle name, CancellationToken cancellationToken = default); /// /// Retrieves a list of all existing databases /// - Task> ListAsync(CancellationToken cancellationToken = default); + ValueTask> ListAsync(CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoDocumentModule.cs b/Core.Arango/Modules/IArangoDocumentModule.cs index 142f2a955d..409fe3d4f6 100644 --- a/Core.Arango/Modules/IArangoDocumentModule.cs +++ b/Core.Arango/Modules/IArangoDocumentModule.cs @@ -26,7 +26,7 @@ public interface IArangoDocumentModule /// HTTP 304 is returned. /// /// - Task GetAsync(ArangoHandle handle, + ValueTask GetAsync(ArangoHandle handle, string collection, string key, bool throwOnError = true, @@ -45,7 +45,7 @@ Task GetAsync(ArangoHandle handle, /// if it has the same revision value /// /// - Task> GetManyAsync(ArangoHandle handle, + ValueTask> GetManyAsync(ArangoHandle handle, string collection, IEnumerable keys, bool? ignoreRevs = null, @@ -54,7 +54,7 @@ Task> GetManyAsync(ArangoHandle handle, /// /// Creates multiple documents /// - Task>> CreateManyAsync(ArangoHandle database, + ValueTask>> CreateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, @@ -70,7 +70,7 @@ Task>> CreateManyAsync(ArangoHandle database, /// /// Creates multiple documents /// - Task>> CreateManyAsync(ArangoHandle database, + ValueTask>> CreateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, @@ -86,7 +86,7 @@ Task>> CreateManyAsync(ArangoHandle datab /// /// Create document /// - Task> CreateAsync(ArangoHandle database, + ValueTask> CreateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, @@ -101,7 +101,7 @@ Task> CreateAsync(ArangoHandle database, /// /// Create document /// - Task> CreateAsync(ArangoHandle database, + ValueTask> CreateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, @@ -116,14 +116,14 @@ Task> CreateAsync(ArangoHandle database, /// /// Removes multiple documents /// - Task>> DeleteManyAsync(ArangoHandle database, string collection, + ValueTask>> DeleteManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? returnOld = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); /// /// Removes single document by key /// - Task> DeleteAsync(ArangoHandle database, string collection, string key, + ValueTask> DeleteAsync(ArangoHandle database, string collection, string key, bool? waitForSync = null, bool? returnOld = null, bool? silent = null, bool? exclusive = null, string ifMatch = null, CancellationToken cancellationToken = default); @@ -137,13 +137,13 @@ IAsyncEnumerable> ExportAsync(ArangoHandle database, string collectio /// /// Bulk import /// - Task ImportAsync(ArangoHandle database, string collection, IEnumerable docs, bool complete = true, + ValueTask ImportAsync(ArangoHandle database, string collection, IEnumerable docs, bool complete = true, CancellationToken cancellationToken = default); /// /// Replaces multiple documents /// - Task>> ReplaceManyAsync(ArangoHandle database, string collection, + ValueTask>> ReplaceManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? returnOld = null, bool? returnNew = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); @@ -151,7 +151,7 @@ Task>> ReplaceManyAsync(ArangoHandle database /// /// Replaces multiple documents /// - Task>> ReplaceManyAsync(ArangoHandle database, string collection, + ValueTask>> ReplaceManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? returnOld = null, bool? returnNew = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); @@ -159,21 +159,21 @@ Task>> ReplaceManyAsync(ArangoHandle data /// /// Replace single document /// - Task> ReplaceAsync(ArangoHandle database, string collection, T doc, + ValueTask> ReplaceAsync(ArangoHandle database, string collection, T doc, bool waitForSync = false, bool? returnOld = null, bool? returnNew = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); /// /// Replace single document /// - Task> ReplaceAsync(ArangoHandle database, string collection, T doc, + ValueTask> ReplaceAsync(ArangoHandle database, string collection, T doc, bool waitForSync = false, bool? returnOld = null, bool? returnNew = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); /// /// Updates multiple documents /// - Task>> UpdateManyAsync(ArangoHandle database, string collection, + ValueTask>> UpdateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); @@ -181,7 +181,7 @@ Task>> UpdateManyAsync(ArangoHandle datab /// /// Updates multiple documents /// - Task>> UpdateManyAsync(ArangoHandle database, string collection, + ValueTask>> UpdateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); @@ -189,7 +189,7 @@ Task>> UpdateManyAsync(ArangoHandle database, /// /// Updates single document /// - Task> UpdateAsync(ArangoHandle database, string collection, T doc, + ValueTask> UpdateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); @@ -197,7 +197,7 @@ Task> UpdateAsync(ArangoHandle database, strin /// /// Updates single document /// - Task> UpdateAsync(ArangoHandle database, string collection, T doc, + ValueTask> UpdateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? ignoreRevs = null, bool? exclusive = null, CancellationToken cancellationToken = default); diff --git a/Core.Arango/Modules/IArangoFoxxModule.cs b/Core.Arango/Modules/IArangoFoxxModule.cs index 50578cc02b..a47a4f88c4 100644 --- a/Core.Arango/Modules/IArangoFoxxModule.cs +++ b/Core.Arango/Modules/IArangoFoxxModule.cs @@ -18,7 +18,7 @@ public interface IArangoFoxxModule /// Whether or not system services should be excluded from the result. /// /// - Task> ListServicesAsync(ArangoHandle database, bool? excludeSystem = null, + ValueTask> ListServicesAsync(ArangoHandle database, bool? excludeSystem = null, CancellationToken cancellationToken = default); /// @@ -32,7 +32,7 @@ Task> ListServicesAsync(ArangoHandle database, bo /// Set to true to install the service in 2.8 legacy compatibility mode. /// /// - Task InstallServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, + ValueTask InstallServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, bool? development = null, bool? setup = null, bool? legacy = null, CancellationToken cancellationToken = default); @@ -48,7 +48,7 @@ Task InstallServiceAsync(ArangoHandle database, string mount, Arango /// Set to true to force service install even if no service is installed under given mount. /// /// - Task ReplaceServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, + ValueTask ReplaceServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, bool? teardown = null, bool? setup = null, bool? legacy = null, bool? force = null, CancellationToken cancellationToken = default); @@ -64,89 +64,89 @@ Task ReplaceServiceAsync(ArangoHandle database, string mount, Arango /// Set to true to force service install even if no service is installed under given mount. /// /// - Task UpgradeServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, + ValueTask UpgradeServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, bool? teardown = null, bool? setup = null, bool? legacy = null, bool? force = null, CancellationToken cancellationToken = default); /// /// Uninstall service /// - Task UninstallServiceAsync(ArangoHandle database, string mount, + ValueTask UninstallServiceAsync(ArangoHandle database, string mount, bool? teardown = null, CancellationToken cancellationToken = default); /// /// Get configuration options /// - Task GetConfigurationAsync(ArangoHandle database, string mount, + ValueTask GetConfigurationAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default); /// /// Update configuration options /// - Task UpdateConfigurationAsync(ArangoHandle database, string mount, + ValueTask UpdateConfigurationAsync(ArangoHandle database, string mount, object configuration = null, CancellationToken cancellationToken = default); /// /// Replace configuration options /// - Task ReplaceConfigurationAsync(ArangoHandle database, string mount, + ValueTask ReplaceConfigurationAsync(ArangoHandle database, string mount, object configuration = null, CancellationToken cancellationToken = default); /// /// Get dependency options /// - Task GetDependenciesAsync(ArangoHandle database, string mount, + ValueTask GetDependenciesAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default); /// /// Update dependency options /// - Task UpdateDependenciesAsync(ArangoHandle database, string mount, + ValueTask UpdateDependenciesAsync(ArangoHandle database, string mount, object dependencies = null, CancellationToken cancellationToken = default); /// /// Replace dependency options /// - Task ReplaceDependenciesAsync(ArangoHandle database, string mount, + ValueTask ReplaceDependenciesAsync(ArangoHandle database, string mount, object dependencies = null, CancellationToken cancellationToken = default); /// /// HTTP GET request to Foxx service /// - Task GetAsync(ArangoHandle database, string path, + ValueTask GetAsync(ArangoHandle database, string path, IDictionary queryParams = null, CancellationToken cancellationToken = default); /// /// HTTP POST request to Foxx service /// - Task PostAsync(ArangoHandle database, string path, object body, + ValueTask PostAsync(ArangoHandle database, string path, object body, IDictionary queryParams = null, CancellationToken cancellationToken = default); /// /// HTTP PUT request to Foxx service /// - Task PutAsync(ArangoHandle database, string path, object body, + ValueTask PutAsync(ArangoHandle database, string path, object body, IDictionary queryParams = null, CancellationToken cancellationToken = default); /// /// HTTP PATCH request to Foxx service /// - Task PatchAsync(ArangoHandle database, string path, object body, + ValueTask PatchAsync(ArangoHandle database, string path, object body, IDictionary queryParams = null, CancellationToken cancellationToken = default); /// /// HTTP DELETE request to Foxx service /// - Task DeleteAsync(ArangoHandle database, string path, + ValueTask DeleteAsync(ArangoHandle database, string path, IDictionary queryParams = null, CancellationToken cancellationToken = default); @@ -157,7 +157,7 @@ Task DeleteAsync(ArangoHandle database, string path, /// Mount path of the installed service. /// /// - Task EnableDevelopmentModeAsync(ArangoHandle database, string mount, + ValueTask EnableDevelopmentModeAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default); /// @@ -167,7 +167,7 @@ Task EnableDevelopmentModeAsync(ArangoHandle database, string mount, /// Mount path of the installed service. /// /// - Task DisableDevelopmentModeAsync(ArangoHandle database, string mount, + ValueTask DisableDevelopmentModeAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default); /// @@ -177,7 +177,7 @@ Task DisableDevelopmentModeAsync(ArangoHandle database, string mount, /// /// /// - Task DownloadServiceAsync(ArangoHandle database, string mount, + ValueTask DownloadServiceAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default); /// @@ -189,7 +189,7 @@ Task DownloadServiceAsync(ArangoHandle database, string mount, /// /// /// - Task RunServiceScriptAsync(ArangoHandle database, string mount, string name, + ValueTask RunServiceScriptAsync(ArangoHandle database, string mount, string name, object body = null, CancellationToken cancellationToken = default); } diff --git a/Core.Arango/Modules/IArangoFunctionModule.cs b/Core.Arango/Modules/IArangoFunctionModule.cs index a3a0e3c055..d89c3bc170 100644 --- a/Core.Arango/Modules/IArangoFunctionModule.cs +++ b/Core.Arango/Modules/IArangoFunctionModule.cs @@ -14,7 +14,7 @@ public interface IArangoFunctionModule /// create a new AQL user function /// /// true if newly created - Task CreateAsync(ArangoHandle database, ArangoFunctionDefinition request, + ValueTask CreateAsync(ArangoHandle database, ArangoFunctionDefinition request, CancellationToken cancellationToken = default); /// @@ -28,7 +28,7 @@ Task CreateAsync(ArangoHandle database, ArangoFunctionDefinition request, /// /// /// number of deleted functions - Task RemoveAsync(ArangoHandle database, string name, bool? group = false, + ValueTask RemoveAsync(ArangoHandle database, string name, bool? group = false, CancellationToken cancellationToken = default); /// @@ -38,7 +38,7 @@ Task RemoveAsync(ArangoHandle database, string name, bool? group = false, /// filter user functions from namespace /// /// list of function definitions - Task> ListAsync(ArangoHandle database, string ns = null, + ValueTask> ListAsync(ArangoHandle database, string ns = null, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoGraphEdgeModule.cs b/Core.Arango/Modules/IArangoGraphEdgeModule.cs index aa7386d005..a95ad42975 100644 --- a/Core.Arango/Modules/IArangoGraphEdgeModule.cs +++ b/Core.Arango/Modules/IArangoGraphEdgeModule.cs @@ -12,13 +12,13 @@ public interface IArangoGraphEdgeModule /// /// Fetch an edge /// - Task GetAsync(ArangoHandle database, string graph, string collection, string key, + ValueTask GetAsync(ArangoHandle database, string graph, string collection, string key, CancellationToken cancellationToken = default); /// /// Creates an edge in an existing graph /// - Task> CreateAsync(ArangoHandle database, string graph, string collection, + ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default); @@ -26,7 +26,7 @@ Task> CreateAsync(ArangoHandle database, strin /// /// Modify an existing edge /// - Task> UpdateAsync(ArangoHandle database, string graph, string collection, + ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -34,7 +34,7 @@ Task> UpdateAsync(ArangoHandle database, strin /// /// Replace the content of an existing edge /// - Task> ReplaceAsync(ArangoHandle database, string graph, string collection, + ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -42,7 +42,7 @@ Task> ReplaceAsync(ArangoHandle database, stri /// /// Removes an edge from graph /// - Task> RemoveAsync(ArangoHandle database, string graph, string collection, + ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -50,14 +50,14 @@ Task> RemoveAsync(ArangoHandle database, strin /// /// Creates an edge in an existing graph /// - Task> CreateAsync(ArangoHandle database, string graph, string collection, T doc, + ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default); /// /// Modify an existing edge /// - Task> UpdateAsync(ArangoHandle database, string graph, string collection, + ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -65,7 +65,7 @@ Task> UpdateAsync(ArangoHandle database, string gr /// /// Replace the content of an existing edge /// - Task> ReplaceAsync(ArangoHandle database, string graph, string collection, + ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -73,7 +73,7 @@ Task> ReplaceAsync(ArangoHandle database, string g /// /// Removes an edge from graph /// - Task> RemoveAsync(ArangoHandle database, string graph, string collection, + ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default); diff --git a/Core.Arango/Modules/IArangoGraphModule.cs b/Core.Arango/Modules/IArangoGraphModule.cs index bd3c275c74..188d073a40 100644 --- a/Core.Arango/Modules/IArangoGraphModule.cs +++ b/Core.Arango/Modules/IArangoGraphModule.cs @@ -23,40 +23,40 @@ public interface IArangoGraphModule /// /// Create a new graph in the graph module. /// - Task CreateAsync(ArangoHandle database, ArangoGraph request, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoHandle database, ArangoGraph request, CancellationToken cancellationToken = default); /// /// Delete an existing graph. /// - Task DropAsync(ArangoHandle database, string name, CancellationToken cancellationToken = default); + ValueTask DropAsync(ArangoHandle database, string name, CancellationToken cancellationToken = default); /// /// Lists all graphs known to the graph module. /// - Task> ListAsync(ArangoHandle database, + ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// Get a graph from the graph module. /// - Task GetAsync(ArangoHandle database, string graph, CancellationToken cancellationToken = default); + ValueTask GetAsync(ArangoHandle database, string graph, CancellationToken cancellationToken = default); /// /// Add an additional vertex collection to the graph. /// - Task AddVertexCollectionAsync(ArangoHandle database, string graph, ArangoVertexCollection vertexCollection, + ValueTask AddVertexCollectionAsync(ArangoHandle database, string graph, ArangoVertexCollection vertexCollection, CancellationToken cancellationToken = default); /// /// Add a new edge definition to the graph /// - Task AddEdgeDefinitionAsync(ArangoHandle database, string graph, ArangoEdgeDefinition edgeDefinition, + ValueTask AddEdgeDefinitionAsync(ArangoHandle database, string graph, ArangoEdgeDefinition edgeDefinition, CancellationToken cancellationToken = default); /// /// Remove a vertex collection form the graph. /// - Task RemoveVertexCollectionAsync(ArangoHandle database, string graph, string vertexCollection, + ValueTask RemoveVertexCollectionAsync(ArangoHandle database, string graph, string vertexCollection, bool? dropCollection = null, CancellationToken cancellationToken = default); @@ -64,14 +64,14 @@ Task RemoveVertexCollectionAsync(ArangoHandle database, string graph, string ver /// Replace an existing edge definition /// /// - Task ReplaceEdgeDefinitionAsync(ArangoHandle database, string graph, ArangoEdgeDefinition edgeDefinition, + ValueTask ReplaceEdgeDefinitionAsync(ArangoHandle database, string graph, ArangoEdgeDefinition edgeDefinition, bool? dropCollections = null, CancellationToken cancellationToken = default); /// /// Remove an edge definition form the graph /// - Task RemoveEdgeDefinitionAsync(ArangoHandle database, string graph, string edgeDefinition, + ValueTask RemoveEdgeDefinitionAsync(ArangoHandle database, string graph, string edgeDefinition, bool? dropCollections = null, CancellationToken cancellationToken = default); } diff --git a/Core.Arango/Modules/IArangoGraphVertexModule.cs b/Core.Arango/Modules/IArangoGraphVertexModule.cs index 9eb7f00f45..709bebe691 100644 --- a/Core.Arango/Modules/IArangoGraphVertexModule.cs +++ b/Core.Arango/Modules/IArangoGraphVertexModule.cs @@ -12,13 +12,13 @@ public interface IArangoGraphVertexModule /// /// fetches an existing vertex /// - Task GetAsync(ArangoHandle database, string graph, string collection, string key, + ValueTask GetAsync(ArangoHandle database, string graph, string collection, string key, CancellationToken cancellationToken = default); /// /// Create a new vertex /// - Task> CreateAsync(ArangoHandle database, string graph, string collection, + ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default); @@ -26,14 +26,14 @@ Task> CreateAsync(ArangoHandle database, str /// /// Create a new vertex /// - Task> CreateAsync(ArangoHandle database, string graph, string collection, T doc, + ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default); /// /// Update an existing vertex /// - Task> UpdateAsync(ArangoHandle database, string graph, string collection, + ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -41,7 +41,7 @@ Task> UpdateAsync(ArangoHandle database, str /// /// Update an existing vertex /// - Task> UpdateAsync(ArangoHandle database, string graph, string collection, + ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -49,7 +49,7 @@ Task> UpdateAsync(ArangoHandle database, string /// /// Replaces an existing vertex /// - Task> ReplaceAsync(ArangoHandle database, string graph, string collection, + ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -57,7 +57,7 @@ Task> ReplaceAsync(ArangoHandle database, st /// /// Replaces an existing vertex /// - Task> ReplaceAsync(ArangoHandle database, string graph, string collection, + ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -65,7 +65,7 @@ Task> ReplaceAsync(ArangoHandle database, string /// /// Removes a vertex from a graph /// - Task> RemoveAsync(ArangoHandle database, string graph, string collection, + ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default); @@ -73,7 +73,7 @@ Task> RemoveAsync(ArangoHandle database, string /// /// Removes a vertex from a graph /// - Task> RemoveAsync(ArangoHandle database, string graph, string collection, + ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default); diff --git a/Core.Arango/Modules/IArangoIndexModule.cs b/Core.Arango/Modules/IArangoIndexModule.cs index 896af87858..ba1458df85 100644 --- a/Core.Arango/Modules/IArangoIndexModule.cs +++ b/Core.Arango/Modules/IArangoIndexModule.cs @@ -13,23 +13,23 @@ public interface IArangoIndexModule /// /// creates an index /// - Task CreateAsync(ArangoHandle database, string collection, ArangoIndex request, + ValueTask CreateAsync(ArangoHandle database, string collection, ArangoIndex request, CancellationToken cancellationToken = default); /// /// Drops all indices of a database /// - Task DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default); + ValueTask DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// Drops an index /// - Task DropAsync(ArangoHandle database, string index, CancellationToken cancellationToken = default); + ValueTask DropAsync(ArangoHandle database, string index, CancellationToken cancellationToken = default); /// /// Returns all indexes of a collection /// - Task> ListAsync(ArangoHandle database, string collection, + ValueTask> ListAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoPregelModule.cs b/Core.Arango/Modules/IArangoPregelModule.cs index 9998f31a83..ae093cd028 100644 --- a/Core.Arango/Modules/IArangoPregelModule.cs +++ b/Core.Arango/Modules/IArangoPregelModule.cs @@ -12,18 +12,18 @@ public interface IArangoPregelModule /// /// Start the execution of a Pregel algorithm /// - Task StartJobAsync(ArangoHandle database, ArangoPregel job, + ValueTask StartJobAsync(ArangoHandle database, ArangoPregel job, CancellationToken cancellationToken = default); /// /// Get the status of a Pregel execution /// - Task GetJobStatusAsync(ArangoHandle database, string id, + ValueTask GetJobStatusAsync(ArangoHandle database, string id, CancellationToken cancellationToken = default); /// /// Cancel an ongoing Pregel execution /// - Task DeleteJobAsync(ArangoHandle database, string id, CancellationToken cancellationToken = default); + ValueTask DeleteJobAsync(ArangoHandle database, string id, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoQueryModule.cs b/Core.Arango/Modules/IArangoQueryModule.cs index f059f9d510..64f4211f5e 100644 --- a/Core.Arango/Modules/IArangoQueryModule.cs +++ b/Core.Arango/Modules/IArangoQueryModule.cs @@ -21,7 +21,7 @@ public interface IArangoQueryModule /// RETURN expression /// /// - Task> FindAsync(ArangoHandle database, string collection, FormattableString filter, + ValueTask> FindAsync(ArangoHandle database, string collection, FormattableString filter, string projection = null, int limit = 1000, CancellationToken cancellationToken = default); /// @@ -33,26 +33,26 @@ Task> FindAsync(ArangoHandle database, string collection, Formattable /// FILTER expression with "x." /// RETURN expression /// - Task SingleOrDefaultAsync(ArangoHandle database, string collection, FormattableString filter, + ValueTask SingleOrDefaultAsync(ArangoHandle database, string collection, FormattableString filter, string projection = null, CancellationToken cancellationToken = default); /// /// Execute query (Linq provider) /// - Task ExecuteAsync(Type type, bool isEnumerable, ArangoHandle database, string query, + ValueTask ExecuteAsync(Type type, bool isEnumerable, ArangoHandle database, string query, IDictionary bindVars, bool? cache = null, bool? fullCount = null, CancellationToken cancellationToken = default); /// /// Execute query with string interpolated bind parameters /// - Task> ExecuteAsync(ArangoHandle database, FormattableString query, bool? cache = null, + ValueTask> ExecuteAsync(ArangoHandle database, FormattableString query, bool? cache = null, bool? fullCount = null, CancellationToken cancellationToken = default); /// /// Execute query with bind parameters in dictionary /// - Task> ExecuteAsync(ArangoHandle database, string query, IDictionary bindVars, + ValueTask> ExecuteAsync(ArangoHandle database, string query, IDictionary bindVars, bool? cache = null, bool? fullCount = null, CancellationToken cancellationToken = default); /// @@ -82,7 +82,7 @@ IAsyncEnumerable ExecuteStreamAsync(ArangoHandle database, ArangoCursor cu /// /// explain an AQL query and return information about it /// - Task ExplainAsync(ArangoHandle database, string query, + ValueTask ExplainAsync(ArangoHandle database, string query, IDictionary bindVars, bool allPlans = false, CancellationToken cancellationToken = default); @@ -90,14 +90,14 @@ Task ExplainAsync(ArangoHandle database, string query, /// /// explain an AQL query and return information about it /// - Task ExplainAsync(ArangoHandle database, FormattableString query, + ValueTask ExplainAsync(ArangoHandle database, FormattableString query, bool allPlans = false, CancellationToken cancellationToken = default); /// /// parse an AQL query and return information about it /// - Task ParseAsync(ArangoHandle database, string query, + ValueTask ParseAsync(ArangoHandle database, string query, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoTransactionModule.cs b/Core.Arango/Modules/IArangoTransactionModule.cs index 2b50770fce..3612bea73d 100644 --- a/Core.Arango/Modules/IArangoTransactionModule.cs +++ b/Core.Arango/Modules/IArangoTransactionModule.cs @@ -12,23 +12,23 @@ public interface IArangoTransactionModule /// /// Begin a server-side transaction /// - Task BeginAsync(ArangoHandle database, ArangoTransaction request, + ValueTask BeginAsync(ArangoHandle database, ArangoTransaction request, CancellationToken cancellationToken = default); /// /// Abort a server-side transaction /// - Task AbortAsync(ArangoHandle database, CancellationToken cancellationToken = default); + ValueTask AbortAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// Commit a server-side transaction /// - Task CommitAsync(ArangoHandle database, CancellationToken cancellationToken = default); + ValueTask CommitAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// execute a server-side (script) transaction /// - Task ExecuteAsync(ArangoHandle database, ArangoTransaction request, + ValueTask ExecuteAsync(ArangoHandle database, ArangoTransaction request, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoUserModule.cs b/Core.Arango/Modules/IArangoUserModule.cs index aabf79205f..25155685fa 100644 --- a/Core.Arango/Modules/IArangoUserModule.cs +++ b/Core.Arango/Modules/IArangoUserModule.cs @@ -13,34 +13,34 @@ public interface IArangoUserModule /// /// Create a new user. /// - Task CreateAsync(ArangoUser user, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoUser user, CancellationToken cancellationToken = default); /// /// Delete a user permanently. /// - Task DeleteAsync(string user, CancellationToken cancellationToken = default); + ValueTask DeleteAsync(string user, CancellationToken cancellationToken = default); /// /// Clear the database access level, revert back to the default access level /// - Task DeleteDatabaseAccessAsync(ArangoHandle handle, string user, + ValueTask DeleteDatabaseAccessAsync(ArangoHandle handle, string user, CancellationToken cancellationToken = default); /// /// Lists all users /// - Task> ListAsync(CancellationToken cancellationToken = default); + ValueTask> ListAsync(CancellationToken cancellationToken = default); /// /// Modify attributes of an existing user /// - Task PatchAsync(ArangoUser user, CancellationToken cancellationToken = default); + ValueTask PatchAsync(ArangoUser user, CancellationToken cancellationToken = default); /// /// Set the database access level. /// - Task SetDatabaseAccessAsync(ArangoHandle handle, string user, ArangoAccess access, + ValueTask SetDatabaseAccessAsync(ArangoHandle handle, string user, ArangoAccess access, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/IArangoViewModule.cs b/Core.Arango/Modules/IArangoViewModule.cs index 81527d61e7..003cb76a80 100644 --- a/Core.Arango/Modules/IArangoViewModule.cs +++ b/Core.Arango/Modules/IArangoViewModule.cs @@ -13,34 +13,34 @@ public interface IArangoViewModule /// /// creates an ArangoSearch View /// - Task CreateAsync(ArangoHandle database, ArangoView view, CancellationToken cancellationToken = default); + ValueTask CreateAsync(ArangoHandle database, ArangoView view, CancellationToken cancellationToken = default); /// /// changes all properties of an ArangoSearch View /// - Task UpdateAsync(ArangoHandle database, ArangoViewUpdate view, CancellationToken cancellationToken = default); + ValueTask UpdateAsync(ArangoHandle database, ArangoViewUpdate view, CancellationToken cancellationToken = default); /// /// partially changes properties of an ArangoSearch View /// - Task PatchAsync(ArangoHandle database, ArangoViewPatch view, CancellationToken cancellationToken = default); + ValueTask PatchAsync(ArangoHandle database, ArangoViewPatch view, CancellationToken cancellationToken = default); /// /// Drops all Views in database /// - Task DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default); + ValueTask DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// /// Drops a View /// - Task DropAsync(ArangoHandle database, string name, CancellationToken cancellationToken = default); + ValueTask DropAsync(ArangoHandle database, string name, CancellationToken cancellationToken = default); /// /// Returns all Views /// - Task> ListAsync(ArangoHandle database, + ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// @@ -50,7 +50,7 @@ Task> ListAsync(ArangoHandle database /// /// /// - Task GetPropertiesAsync(ArangoHandle database, string view, + ValueTask GetPropertiesAsync(ArangoHandle database, string view, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/Core.Arango/Modules/Internal/ArangoAnalyzerModule.cs b/Core.Arango/Modules/Internal/ArangoAnalyzerModule.cs index d7c522c930..3b742c2de6 100644 --- a/Core.Arango/Modules/Internal/ArangoAnalyzerModule.cs +++ b/Core.Arango/Modules/Internal/ArangoAnalyzerModule.cs @@ -13,7 +13,7 @@ internal ArangoAnalyzerModule(IArangoContext context) : base(context) { } - public async Task> ListAsync(ArangoHandle database, + public async ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default) { return (await SendAsync>(database, HttpMethod.Get, @@ -21,7 +21,7 @@ public async Task> ListAsync(ArangoHandle da cancellationToken: cancellationToken)).Result; } - public async Task GetDefinitionAsync(ArangoHandle database, string analyzer, + public async ValueTask GetDefinitionAsync(ArangoHandle database, string analyzer, CancellationToken cancellationToken = default) { return await SendAsync(database, HttpMethod.Get, @@ -29,7 +29,7 @@ public async Task GetDefinitionAsync(ArangoHandle database, stri cancellationToken: cancellationToken); } - public async Task CreateAsync(ArangoHandle database, + public async ValueTask CreateAsync(ArangoHandle database, ArangoAnalyzer analyzer, CancellationToken cancellationToken = default) { @@ -39,7 +39,7 @@ await SendAsync>(database, HttpMethod.Post, cancellationToken: cancellationToken); } - public async Task DeleteAsync(ArangoHandle database, + public async ValueTask DeleteAsync(ArangoHandle database, string analyzer, bool force = false, CancellationToken cancellationToken = default) { diff --git a/Core.Arango/Modules/Internal/ArangoBackupModule.cs b/Core.Arango/Modules/Internal/ArangoBackupModule.cs index fb38690d44..2fc147c3ee 100644 --- a/Core.Arango/Modules/Internal/ArangoBackupModule.cs +++ b/Core.Arango/Modules/Internal/ArangoBackupModule.cs @@ -14,7 +14,7 @@ internal ArangoBackupModule(IArangoContext context) : base(context) { } - public async Task CreateAsync(ArangoBackupRequest request, + public async ValueTask CreateAsync(ArangoBackupRequest request, CancellationToken cancellationToken = default) { var res = await SendAsync>(null, HttpMethod.Post, "/_admin/backup/create", @@ -23,7 +23,7 @@ public async Task CreateAsync(ArangoBackupRequest request, return res.Result; } - public async Task RestoreAsync(string id, CancellationToken cancellationToken = default) + public async ValueTask RestoreAsync(string id, CancellationToken cancellationToken = default) { await SendAsync(null, HttpMethod.Post, "/_admin/backup/restore", new @@ -32,7 +32,7 @@ await SendAsync(null, HttpMethod.Post, "/_admin/backup/restore", }, cancellationToken: cancellationToken); } - public async Task DeleteAsync(string id, CancellationToken cancellationToken = default) + public async ValueTask DeleteAsync(string id, CancellationToken cancellationToken = default) { await SendAsync(null, HttpMethod.Post, "/_admin/backup/delete", new @@ -41,7 +41,7 @@ await SendAsync(null, HttpMethod.Post, "/_admin/backup/delete", }, cancellationToken: cancellationToken); } - public async Task> ListAsync(string id = null, CancellationToken cancellationToken = default) + public async ValueTask> ListAsync(string id = null, CancellationToken cancellationToken = default) { object req = null; diff --git a/Core.Arango/Modules/Internal/ArangoCollectionModule.cs b/Core.Arango/Modules/Internal/ArangoCollectionModule.cs index 0841fd8830..02c921302e 100644 --- a/Core.Arango/Modules/Internal/ArangoCollectionModule.cs +++ b/Core.Arango/Modules/Internal/ArangoCollectionModule.cs @@ -14,7 +14,7 @@ public ArangoCollectionModule(IArangoContext context) : base(context) { } - public async Task CreateAsync(ArangoHandle database, string collection, ArangoCollectionType type, + public async ValueTask CreateAsync(ArangoHandle database, string collection, ArangoCollectionType type, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Post, @@ -26,7 +26,7 @@ await SendAsync(database, HttpMethod.Post, }, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task CreateAsync(ArangoHandle database, ArangoCollection collection, + public async ValueTask CreateAsync(ArangoHandle database, ArangoCollection collection, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Post, @@ -35,7 +35,7 @@ await SendAsync(database, HttpMethod.Post, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task TruncateAsync(ArangoHandle database, string collection, + public async ValueTask TruncateAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Put, @@ -43,7 +43,7 @@ await SendAsync(database, HttpMethod.Put, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task> ListAsync(ArangoHandle database, + public async ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default) { var res = await SendAsync>(database, HttpMethod.Get, @@ -52,7 +52,7 @@ public async Task> ListAsync(ArangoHandle return res.Result; } - public async Task UpdateAsync(ArangoHandle database, string collection, ArangoCollectionUpdate update, + public async ValueTask UpdateAsync(ArangoHandle database, string collection, ArangoCollectionUpdate update, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Put, @@ -61,7 +61,7 @@ await SendAsync(database, HttpMethod.Put, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task RenameAsync(ArangoHandle database, string oldname, string newname, + public async ValueTask RenameAsync(ArangoHandle database, string oldname, string newname, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Put, @@ -73,7 +73,7 @@ await SendAsync(database, HttpMethod.Put, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task ExistAsync(ArangoHandle database, string collection, + public async ValueTask ExistAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { var collections = await ListAsync(database, cancellationToken).ConfigureAwait(false); @@ -81,7 +81,7 @@ public async Task ExistAsync(ArangoHandle database, string collection, return collections.Any(x => x.Name.Equals(collection)); } - public async Task CompactAsync(ArangoHandle database, string collection, + public async ValueTask CompactAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { await SendAsync( @@ -90,7 +90,7 @@ await SendAsync( null, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task RecalculateCountAsync(ArangoHandle database, string collection, + public async ValueTask RecalculateCountAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { await SendAsync( @@ -99,7 +99,7 @@ await SendAsync( null, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task GetAsync(ArangoHandle database, string collection, + public async ValueTask GetAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { return await SendAsync( @@ -108,7 +108,7 @@ public async Task GetAsync(ArangoHandle database, string colle null, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task DropAsync(ArangoHandle database, string collection, + public async ValueTask DropAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Delete, diff --git a/Core.Arango/Modules/Internal/ArangoDatabaseModule.cs b/Core.Arango/Modules/Internal/ArangoDatabaseModule.cs index ec4782c8c8..1add6a5e42 100644 --- a/Core.Arango/Modules/Internal/ArangoDatabaseModule.cs +++ b/Core.Arango/Modules/Internal/ArangoDatabaseModule.cs @@ -14,7 +14,7 @@ internal ArangoDatabaseModule(IArangoContext context) : base(context) { } - public async Task CreateAsync(ArangoHandle name, CancellationToken cancellationToken = default) + public async ValueTask CreateAsync(ArangoHandle name, CancellationToken cancellationToken = default) { var res = await SendAsync(null, HttpMethod.Post, ApiPath("_system", "database"), @@ -26,7 +26,7 @@ public async Task CreateAsync(ArangoHandle name, CancellationToken cancell return res != null; } - public async Task CreateAsync(ArangoDatabase database, CancellationToken cancellationToken = default) + public async ValueTask CreateAsync(ArangoDatabase database, CancellationToken cancellationToken = default) { database.Name = RealmPrefix(database.Name); @@ -37,7 +37,7 @@ public async Task CreateAsync(ArangoDatabase database, CancellationToken c return res != null; } - public async Task GetAsync(ArangoHandle handle, + public async ValueTask GetAsync(ArangoHandle handle, CancellationToken cancellationToken = default) { var res = await SendAsync>(null, HttpMethod.Get, @@ -47,7 +47,7 @@ public async Task GetAsync(ArangoHandle handle, return res?.Result; } - public async Task> ListAsync(CancellationToken cancellationToken = default) + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) { var res = await SendAsync>(null, HttpMethod.Get, ApiPath("_system", "database"), cancellationToken: cancellationToken); @@ -62,13 +62,13 @@ public async Task> ListAsync(CancellationToken cancellationToken = .ToList(); } - public async Task ExistAsync(ArangoHandle handle, CancellationToken cancellationToken = default) + public async ValueTask ExistAsync(ArangoHandle handle, CancellationToken cancellationToken = default) { var db = await GetAsync(handle, cancellationToken); return db != null; } - public async Task DropAsync(ArangoHandle name, CancellationToken cancellationToken = default) + public async ValueTask DropAsync(ArangoHandle name, CancellationToken cancellationToken = default) { await SendAsync(name, HttpMethod.Delete, ApiPath("_system", $"database/{RealmPrefix(name)}"), null, diff --git a/Core.Arango/Modules/Internal/ArangoDocumentModule.cs b/Core.Arango/Modules/Internal/ArangoDocumentModule.cs index f1970b6858..de75d06fea 100644 --- a/Core.Arango/Modules/Internal/ArangoDocumentModule.cs +++ b/Core.Arango/Modules/Internal/ArangoDocumentModule.cs @@ -15,7 +15,7 @@ internal ArangoDocumentModule(IArangoContext context) : base(context) { } - public async Task GetAsync(ArangoHandle database, string collection, string key, + public async ValueTask GetAsync(ArangoHandle database, string collection, string key, bool throwOnError = true, string ifMatch = null, string ifNoneMatch = null, @@ -33,7 +33,7 @@ public async Task GetAsync(ArangoHandle database, string collection, strin null, throwOnError, headers: headers, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task> GetManyAsync(ArangoHandle database, string collection, IEnumerable docs, + public async ValueTask> GetManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? ignoreRevs = null, CancellationToken cancellationToken = default) { @@ -48,7 +48,7 @@ public async Task> GetManyAsync(ArangoHandle database, string collect cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task>> CreateManyAsync(ArangoHandle database, + public async ValueTask>> CreateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? exclusive = null, ArangoOverwriteMode? overwriteMode = null, @@ -86,7 +86,7 @@ public async Task>> CreateManyAsync(ArangoHan docs, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task>> CreateManyAsync(ArangoHandle database, + public async ValueTask>> CreateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? exclusive = null, ArangoOverwriteMode? overwriteMode = null, @@ -97,7 +97,7 @@ public async Task>> CreateManyAsync(Arang returnOld, returnNew, silent, exclusive, overwriteMode, cancellationToken).ConfigureAwait(false); } - public async Task> CreateAsync(ArangoHandle database, string collection, T doc, + public async ValueTask> CreateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, bool? exclusive = null, ArangoOverwriteMode? overwriteMode = null, @@ -110,7 +110,7 @@ public async Task> CreateAsync(ArangoHandle databa return res?.SingleOrDefault(); } - public async Task> CreateAsync(ArangoHandle database, string collection, + public async ValueTask> CreateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, bool? mergeObjects = null, bool? returnOld = null, bool? returnNew = null, bool? silent = null, @@ -123,7 +123,7 @@ public async Task> CreateAsync(ArangoHandle da return res?.SingleOrDefault(); } - public async Task ImportAsync(ArangoHandle database, string collection, IEnumerable docs, + public async ValueTask ImportAsync(ArangoHandle database, string collection, IEnumerable docs, bool complete = true, CancellationToken cancellationToken = default) { @@ -140,7 +140,7 @@ await SendAsync(database, HttpMethod.Post, query, cancellationToken: cancellationToken); } - public async Task> DeleteAsync(ArangoHandle database, string collection, + public async ValueTask> DeleteAsync(ArangoHandle database, string collection, string key, bool? waitForSync = null, bool? returnOld = null, @@ -176,7 +176,7 @@ public async Task> DeleteAsync(ArangoHandle database, cancellationToken: cancellationToken); } - public async Task>> DeleteManyAsync(ArangoHandle database, + public async ValueTask>> DeleteManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? returnOld = null, @@ -206,7 +206,7 @@ public async Task>> DeleteManyAsync(ArangoHan cancellationToken: cancellationToken); } - public async Task>> UpdateManyAsync(ArangoHandle database, + public async ValueTask>> UpdateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? keepNull = null, @@ -223,7 +223,7 @@ public async Task>> UpdateManyAsync(Arang returnOld, returnNew, silent, ignoreRevs, exclusive, cancellationToken).ConfigureAwait(false); } - public async Task>> UpdateManyAsync(ArangoHandle database, + public async ValueTask>> UpdateManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? keepNull = null, @@ -268,7 +268,7 @@ public async Task>> UpdateManyAsync(ArangoHan docs, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task> UpdateAsync(ArangoHandle database, string collection, + public async ValueTask> UpdateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, @@ -287,7 +287,7 @@ public async Task> UpdateAsync(ArangoHandle da return res.SingleOrDefault(); } - public async Task> UpdateAsync(ArangoHandle database, string collection, + public async ValueTask> UpdateAsync(ArangoHandle database, string collection, T doc, bool? waitForSync = null, bool? keepNull = null, @@ -306,7 +306,7 @@ public async Task> UpdateAsync(ArangoHandle databa return res?.SingleOrDefault(); } - public async Task>> ReplaceManyAsync(ArangoHandle database, + public async ValueTask>> ReplaceManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? returnOld = null, @@ -339,7 +339,7 @@ public async Task>> ReplaceManyAsync(ArangoHa docs, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task>> ReplaceManyAsync(ArangoHandle database, + public async ValueTask>> ReplaceManyAsync(ArangoHandle database, string collection, IEnumerable docs, bool? waitForSync = null, bool? returnOld = null, @@ -352,7 +352,7 @@ public async Task>> ReplaceManyAsync(Aran waitForSync, returnOld, returnNew, ignoreRevs, exclusive, cancellationToken).ConfigureAwait(false); } - public async Task> ReplaceAsync(ArangoHandle database, string collection, + public async ValueTask> ReplaceAsync(ArangoHandle database, string collection, T doc, bool waitForSync = false, bool? returnOld = null, @@ -367,7 +367,7 @@ public async Task> ReplaceAsync(ArangoHandle datab return res?.SingleOrDefault(); } - public async Task> ReplaceAsync(ArangoHandle database, string collection, + public async ValueTask> ReplaceAsync(ArangoHandle database, string collection, T doc, bool waitForSync = false, bool? returnOld = null, diff --git a/Core.Arango/Modules/Internal/ArangoFoxxModule.cs b/Core.Arango/Modules/Internal/ArangoFoxxModule.cs index 98eb2af3c8..d26e73023d 100644 --- a/Core.Arango/Modules/Internal/ArangoFoxxModule.cs +++ b/Core.Arango/Modules/Internal/ArangoFoxxModule.cs @@ -15,7 +15,7 @@ internal ArangoFoxxModule(IArangoContext context) : base(context) { } - public async Task> ListServicesAsync(ArangoHandle database, + public async ValueTask> ListServicesAsync(ArangoHandle database, bool? excludeSystem = null, CancellationToken cancellationToken = default) { @@ -29,7 +29,7 @@ public async Task> ListServicesAsync(ArangoHandle cancellationToken: cancellationToken); } - public async Task InstallServiceAsync(ArangoHandle database, + public async ValueTask InstallServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, bool? development = null, bool? setup = null, bool? legacy = null, CancellationToken cancellationToken = default) @@ -52,7 +52,7 @@ public async Task InstallServiceAsync(ArangoHandle database, return new ArangoVoid(); } - public async Task ReplaceServiceAsync(ArangoHandle database, + public async ValueTask ReplaceServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, bool? teardown = null, bool? setup = null, bool? legacy = null, bool? force = null, CancellationToken cancellationToken = default) @@ -78,7 +78,7 @@ public async Task ReplaceServiceAsync(ArangoHandle database, return new ArangoVoid(); } - public async Task UpgradeServiceAsync(ArangoHandle database, + public async ValueTask UpgradeServiceAsync(ArangoHandle database, string mount, ArangoFoxxSource service, bool? teardown = null, bool? setup = null, bool? legacy = null, bool? force = null, CancellationToken cancellationToken = default) @@ -104,7 +104,7 @@ public async Task UpgradeServiceAsync(ArangoHandle database, return new ArangoVoid(); } - public async Task UninstallServiceAsync(ArangoHandle database, string mount, + public async ValueTask UninstallServiceAsync(ArangoHandle database, string mount, bool? teardown = null, CancellationToken cancellationToken = default) { @@ -118,7 +118,7 @@ public async Task UninstallServiceAsync(ArangoHandle database, strin cancellationToken: cancellationToken); } - public async Task GetConfigurationAsync(ArangoHandle database, string mount, + public async ValueTask GetConfigurationAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default) { var parameter = new Dictionary { { "mount", mount } }; @@ -128,7 +128,7 @@ public async Task GetConfigurationAsync(ArangoHandle database, string moun cancellationToken: cancellationToken); } - public async Task UpdateConfigurationAsync(ArangoHandle database, string mount, + public async ValueTask UpdateConfigurationAsync(ArangoHandle database, string mount, object configuration, CancellationToken cancellationToken = default) { @@ -139,7 +139,7 @@ public async Task UpdateConfigurationAsync(ArangoHandle database, st cancellationToken: cancellationToken); } - public async Task ReplaceConfigurationAsync(ArangoHandle database, string mount, + public async ValueTask ReplaceConfigurationAsync(ArangoHandle database, string mount, object configuration, CancellationToken cancellationToken = default) { @@ -150,7 +150,7 @@ public async Task ReplaceConfigurationAsync(ArangoHandle database, s cancellationToken: cancellationToken); } - public async Task GetDependenciesAsync(ArangoHandle database, string mount, + public async ValueTask GetDependenciesAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default) { var parameter = new Dictionary { { "mount", mount } }; @@ -160,7 +160,7 @@ public async Task GetDependenciesAsync(ArangoHandle database, string mount cancellationToken: cancellationToken); } - public async Task UpdateDependenciesAsync(ArangoHandle database, string mount, + public async ValueTask UpdateDependenciesAsync(ArangoHandle database, string mount, object dependencies, CancellationToken cancellationToken = default) { @@ -171,7 +171,7 @@ public async Task UpdateDependenciesAsync(ArangoHandle database, str cancellationToken: cancellationToken); } - public async Task ReplaceDependenciesAsync(ArangoHandle database, string mount, + public async ValueTask ReplaceDependenciesAsync(ArangoHandle database, string mount, object dependencies, CancellationToken cancellationToken = default) { @@ -182,7 +182,7 @@ public async Task ReplaceDependenciesAsync(ArangoHandle database, st cancellationToken: cancellationToken); } - public async Task EnableDevelopmentModeAsync(ArangoHandle database, string mount, + public async ValueTask EnableDevelopmentModeAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default) { var parameter = new Dictionary { { "mount", mount } }; @@ -192,7 +192,7 @@ await SendAsync(database, HttpMethod.Post, cancellationToken: cancellationToken); } - public async Task DisableDevelopmentModeAsync(ArangoHandle database, string mount, + public async ValueTask DisableDevelopmentModeAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default) { var parameter = new Dictionary { { "mount", mount } }; @@ -202,7 +202,7 @@ await SendAsync(database, HttpMethod.Delete, cancellationToken: cancellationToken); } - public async Task GetAsync(ArangoHandle database, string mount, + public async ValueTask GetAsync(ArangoHandle database, string mount, IDictionary queryParams = null, CancellationToken cancellationToken = default) { @@ -211,7 +211,7 @@ public async Task GetAsync(ArangoHandle database, string mount, cancellationToken: cancellationToken); } - public async Task PostAsync(ArangoHandle database, string mount, object body, + public async ValueTask PostAsync(ArangoHandle database, string mount, object body, IDictionary queryParams = null, CancellationToken cancellationToken = default) { @@ -220,7 +220,7 @@ public async Task PostAsync(ArangoHandle database, string mount, object bo cancellationToken: cancellationToken); } - public async Task PutAsync(ArangoHandle database, string mount, object body, + public async ValueTask PutAsync(ArangoHandle database, string mount, object body, IDictionary queryParams = null, CancellationToken cancellationToken = default) { @@ -229,7 +229,7 @@ public async Task PutAsync(ArangoHandle database, string mount, object bod cancellationToken: cancellationToken); } - public async Task PatchAsync(ArangoHandle database, string mount, object body, + public async ValueTask PatchAsync(ArangoHandle database, string mount, object body, IDictionary queryParams = null, CancellationToken cancellationToken = default) { @@ -238,7 +238,7 @@ public async Task PatchAsync(ArangoHandle database, string mount, object b cancellationToken: cancellationToken); } - public async Task DeleteAsync(ArangoHandle database, string mount, + public async ValueTask DeleteAsync(ArangoHandle database, string mount, IDictionary queryParams = null, CancellationToken cancellationToken = default) { @@ -247,7 +247,7 @@ public async Task DeleteAsync(ArangoHandle database, string mount, cancellationToken: cancellationToken); } - public async Task DownloadServiceAsync(ArangoHandle database, string mount, + public async ValueTask DownloadServiceAsync(ArangoHandle database, string mount, CancellationToken cancellationToken = default) { var parameter = new Dictionary { { "mount", mount } }; @@ -259,7 +259,7 @@ public async Task DownloadServiceAsync(ArangoHandle database, string return await res.ReadAsStreamAsync(); } - public async Task RunServiceScriptAsync(ArangoHandle database, string mount, string name, + public async ValueTask RunServiceScriptAsync(ArangoHandle database, string mount, string name, object body = null, CancellationToken cancellationToken = default) { diff --git a/Core.Arango/Modules/Internal/ArangoFunctionModule.cs b/Core.Arango/Modules/Internal/ArangoFunctionModule.cs index 74c1c14982..609706af17 100644 --- a/Core.Arango/Modules/Internal/ArangoFunctionModule.cs +++ b/Core.Arango/Modules/Internal/ArangoFunctionModule.cs @@ -16,7 +16,7 @@ internal ArangoFunctionModule(IArangoContext context) : base(context) { } - public async Task CreateAsync(ArangoHandle database, ArangoFunctionDefinition request, + public async ValueTask CreateAsync(ArangoHandle database, ArangoFunctionDefinition request, CancellationToken cancellationToken = default) { if (request == null) @@ -28,7 +28,7 @@ public async Task CreateAsync(ArangoHandle database, ArangoFunctionDefinit return res.IsNewlyCreated; } - public async Task RemoveAsync(ArangoHandle database, string name, bool? group = false, + public async ValueTask RemoveAsync(ArangoHandle database, string name, bool? group = false, CancellationToken cancellationToken = default) { var res = await SendAsync(database, HttpMethod.Delete, @@ -38,7 +38,7 @@ public async Task RemoveAsync(ArangoHandle database, string name, bool? gro return res.DeletedCount; } - public async Task> ListAsync(ArangoHandle database, + public async ValueTask> ListAsync(ArangoHandle database, string ns = null, CancellationToken cancellationToken = default) { diff --git a/Core.Arango/Modules/Internal/ArangoGraphEdgeModule.cs b/Core.Arango/Modules/Internal/ArangoGraphEdgeModule.cs index 2f0276b77e..42d96754d4 100644 --- a/Core.Arango/Modules/Internal/ArangoGraphEdgeModule.cs +++ b/Core.Arango/Modules/Internal/ArangoGraphEdgeModule.cs @@ -12,7 +12,7 @@ internal ArangoGraphEdgeModule(IArangoContext context) : base(context) { } - public async Task GetAsync(ArangoHandle database, string graph, string collection, string key, + public async ValueTask GetAsync(ArangoHandle database, string graph, string collection, string key, CancellationToken cancellationToken = default) { var res = await SendAsync>(database, HttpMethod.Get, @@ -22,7 +22,7 @@ public async Task GetAsync(ArangoHandle database, string graph, string c return res.Edge; } - public async Task> CreateAsync(ArangoHandle database, string graph, + public async ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default) @@ -31,7 +31,7 @@ public async Task> CreateAsync(ArangoHandle da cancellationToken); } - public async Task> UpdateAsync(ArangoHandle database, string graph, + public async ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -40,7 +40,7 @@ public async Task> UpdateAsync(ArangoHandle da returnNew, returnOld, cancellationToken); } - public async Task> ReplaceAsync(ArangoHandle database, string graph, + public async ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -49,7 +49,7 @@ public async Task> ReplaceAsync(ArangoHandle d returnNew, returnOld, cancellationToken); } - public async Task> RemoveAsync(ArangoHandle database, string graph, + public async ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -58,7 +58,7 @@ public async Task> RemoveAsync(ArangoHandle da cancellationToken); } - public async Task> CreateAsync(ArangoHandle database, string graph, + public async ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default) @@ -76,7 +76,7 @@ public async Task> CreateAsync(ArangoHandle databa doc, cancellationToken: cancellationToken); } - public async Task> UpdateAsync(ArangoHandle database, string graph, + public async ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -100,7 +100,7 @@ public async Task> UpdateAsync(ArangoHandle databa doc, cancellationToken: cancellationToken); } - public async Task> ReplaceAsync(ArangoHandle database, string graph, + public async ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -124,7 +124,7 @@ public async Task> ReplaceAsync(ArangoHandle datab doc, cancellationToken: cancellationToken); } - public async Task> RemoveAsync(ArangoHandle database, string graph, + public async ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default) diff --git a/Core.Arango/Modules/Internal/ArangoGraphModule.cs b/Core.Arango/Modules/Internal/ArangoGraphModule.cs index 190d7d4986..cc310c4016 100644 --- a/Core.Arango/Modules/Internal/ArangoGraphModule.cs +++ b/Core.Arango/Modules/Internal/ArangoGraphModule.cs @@ -17,7 +17,7 @@ internal ArangoGraphModule(IArangoContext context) : base(context) Edge = new ArangoGraphEdgeModule(context); } - public async Task> ListAsync(ArangoHandle database, + public async ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default) { var res = await SendAsync>(database, HttpMethod.Get, @@ -25,7 +25,7 @@ public async Task> ListAsync(ArangoHandle datab return res.Graphs; } - public async Task GetAsync(ArangoHandle database, string graph, + public async ValueTask GetAsync(ArangoHandle database, string graph, CancellationToken cancellationToken = default) { var res = await SendAsync>(database, HttpMethod.Get, @@ -37,7 +37,7 @@ public async Task GetAsync(ArangoHandle database, string graph, public IArangoGraphVertexModule Vertex { get; } public IArangoGraphEdgeModule Edge { get; } - public async Task CreateAsync(ArangoHandle database, ArangoGraph request, + public async ValueTask CreateAsync(ArangoHandle database, ArangoGraph request, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Post, @@ -45,7 +45,7 @@ await SendAsync(database, HttpMethod.Post, request, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task AddVertexCollectionAsync(ArangoHandle database, string graph, + public async ValueTask AddVertexCollectionAsync(ArangoHandle database, string graph, ArangoVertexCollection vertexCollection, CancellationToken cancellationToken = default) { @@ -54,7 +54,7 @@ await SendAsync(database, HttpMethod.Post, vertexCollection, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task RemoveVertexCollectionAsync(ArangoHandle database, string graph, string vertexCollection, + public async ValueTask RemoveVertexCollectionAsync(ArangoHandle database, string graph, string vertexCollection, bool? dropCollection = null, CancellationToken cancellationToken = default) { @@ -68,7 +68,7 @@ await SendAsync(database, HttpMethod.Delete, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task AddEdgeDefinitionAsync(ArangoHandle database, string graph, + public async ValueTask AddEdgeDefinitionAsync(ArangoHandle database, string graph, ArangoEdgeDefinition edgeDefinition, CancellationToken cancellationToken = default) { @@ -77,7 +77,7 @@ await SendAsync(database, HttpMethod.Post, edgeDefinition, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task ReplaceEdgeDefinitionAsync(ArangoHandle database, string graph, + public async ValueTask ReplaceEdgeDefinitionAsync(ArangoHandle database, string graph, ArangoEdgeDefinition edgeDefinition, bool? dropCollections = null, CancellationToken cancellationToken = default) @@ -92,7 +92,7 @@ await SendAsync(database, HttpMethod.Put, edgeDefinition, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task RemoveEdgeDefinitionAsync(ArangoHandle database, string graph, string edgeDefinition, + public async ValueTask RemoveEdgeDefinitionAsync(ArangoHandle database, string graph, string edgeDefinition, bool? dropCollections = null, CancellationToken cancellationToken = default) { @@ -106,7 +106,7 @@ await SendAsync(database, HttpMethod.Delete, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task DropAsync(ArangoHandle database, string name, + public async ValueTask DropAsync(ArangoHandle database, string name, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Delete, diff --git a/Core.Arango/Modules/Internal/ArangoGraphVertexModule.cs b/Core.Arango/Modules/Internal/ArangoGraphVertexModule.cs index e2946d2339..7a2b8d69c1 100644 --- a/Core.Arango/Modules/Internal/ArangoGraphVertexModule.cs +++ b/Core.Arango/Modules/Internal/ArangoGraphVertexModule.cs @@ -12,7 +12,7 @@ internal ArangoGraphVertexModule(IArangoContext context) : base(context) { } - public async Task GetAsync(ArangoHandle database, string graph, string collection, string key, + public async ValueTask GetAsync(ArangoHandle database, string graph, string collection, string key, CancellationToken cancellationToken = default) { var res = await SendAsync>(database, HttpMethod.Get, @@ -22,7 +22,7 @@ public async Task GetAsync(ArangoHandle database, string graph, string c return res.Vertex; } - public async Task> CreateAsync(ArangoHandle database, string graph, + public async ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default) @@ -31,7 +31,7 @@ public async Task> CreateAsync(ArangoHandle cancellationToken); } - public async Task> CreateAsync(ArangoHandle database, string graph, + public async ValueTask> CreateAsync(ArangoHandle database, string graph, string collection, T doc, bool? waitForSync = null, bool? returnNew = null, CancellationToken cancellationToken = default) @@ -49,7 +49,7 @@ public async Task> CreateAsync(ArangoHandle data doc, cancellationToken: cancellationToken); } - public async Task> UpdateAsync(ArangoHandle database, string graph, + public async ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -58,7 +58,7 @@ public async Task> UpdateAsync(ArangoHandle returnNew, returnOld, cancellationToken); } - public async Task> UpdateAsync(ArangoHandle database, string graph, + public async ValueTask> UpdateAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -82,7 +82,7 @@ public async Task> UpdateAsync(ArangoHandle data doc, cancellationToken: cancellationToken); } - public async Task> ReplaceAsync(ArangoHandle database, string graph, + public async ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -91,7 +91,7 @@ public async Task> ReplaceAsync(ArangoHandle returnNew, returnOld, cancellationToken); } - public async Task> ReplaceAsync(ArangoHandle database, string graph, + public async ValueTask> ReplaceAsync(ArangoHandle database, string graph, string collection, string key, T doc, bool? waitForSync = null, bool? keepNull = null, bool? returnNew = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -115,7 +115,7 @@ public async Task> ReplaceAsync(ArangoHandle dat doc, cancellationToken: cancellationToken); } - public async Task> RemoveAsync(ArangoHandle database, string graph, + public async ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default) @@ -124,7 +124,7 @@ public async Task> RemoveAsync(ArangoHandle dat cancellationToken); } - public async Task> RemoveAsync(ArangoHandle database, string graph, + public async ValueTask> RemoveAsync(ArangoHandle database, string graph, string collection, string key, bool? waitForSync = null, bool? returnOld = null, CancellationToken cancellationToken = default) diff --git a/Core.Arango/Modules/Internal/ArangoIndexModule.cs b/Core.Arango/Modules/Internal/ArangoIndexModule.cs index 776acb8234..b33e35ceb9 100644 --- a/Core.Arango/Modules/Internal/ArangoIndexModule.cs +++ b/Core.Arango/Modules/Internal/ArangoIndexModule.cs @@ -15,7 +15,7 @@ internal ArangoIndexModule(IArangoContext context) : base(context) { } - public async Task CreateAsync(ArangoHandle database, string collection, ArangoIndex request, + public async ValueTask CreateAsync(ArangoHandle database, string collection, ArangoIndex request, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Post, @@ -26,7 +26,7 @@ await SendAsync(database, HttpMethod.Post, /// /// Drops all user created indices over all collections in database /// - public async Task DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default) + public async ValueTask DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default) { var collections = await Context.Collection.ListAsync(database, cancellationToken).ConfigureAwait(false); @@ -42,7 +42,7 @@ public async Task DropAllAsync(ArangoHandle database, CancellationToken cancella /// /// Ignores primary and edge indices /// - public async Task> ListAsync(ArangoHandle database, string collection, + public async ValueTask> ListAsync(ArangoHandle database, string collection, CancellationToken cancellationToken = default) { var res = await SendAsync(database, HttpMethod.Get, @@ -57,7 +57,7 @@ public async Task> ListAsync(ArangoHandle datab }).ToList(); } - public async Task DropAsync(ArangoHandle database, string index, + public async ValueTask DropAsync(ArangoHandle database, string index, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Delete, diff --git a/Core.Arango/Modules/Internal/ArangoModule.cs b/Core.Arango/Modules/Internal/ArangoModule.cs index d5d2742eac..bc84dcea3b 100644 --- a/Core.Arango/Modules/Internal/ArangoModule.cs +++ b/Core.Arango/Modules/Internal/ArangoModule.cs @@ -68,7 +68,7 @@ protected string UrlEncode(string value) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Task SendAsync(ArangoHandle handle, HttpMethod m, + public ValueTask SendAsync(ArangoHandle handle, HttpMethod m, string url, object body = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default) @@ -82,7 +82,7 @@ public Task SendAsync(ArangoHandle handle, HttpMethod m, } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Task SendAsync(Type type, HttpMethod m, string url, object body = null, + public ValueTask SendAsync(Type type, HttpMethod m, string url, object body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default) diff --git a/Core.Arango/Modules/Internal/ArangoPregelModule.cs b/Core.Arango/Modules/Internal/ArangoPregelModule.cs index ae22e79a8a..552ccca96c 100644 --- a/Core.Arango/Modules/Internal/ArangoPregelModule.cs +++ b/Core.Arango/Modules/Internal/ArangoPregelModule.cs @@ -11,7 +11,7 @@ internal ArangoPregelModule(IArangoContext context) : base(context) { } - public async Task StartJobAsync(ArangoHandle database, ArangoPregel job, + public async ValueTask StartJobAsync(ArangoHandle database, ArangoPregel job, CancellationToken cancellationToken = default) { return await SendAsync(database, HttpMethod.Post, @@ -19,7 +19,7 @@ public async Task StartJobAsync(ArangoHandle database, ArangoPregel job, job, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task GetJobStatusAsync(ArangoHandle database, string id, + public async ValueTask GetJobStatusAsync(ArangoHandle database, string id, CancellationToken cancellationToken = default) { return await SendAsync(database, HttpMethod.Get, @@ -27,7 +27,7 @@ public async Task GetJobStatusAsync(ArangoHandle database, s cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task DeleteJobAsync(ArangoHandle database, string id, + public async ValueTask DeleteJobAsync(ArangoHandle database, string id, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Delete, diff --git a/Core.Arango/Modules/Internal/ArangoQueryModule.cs b/Core.Arango/Modules/Internal/ArangoQueryModule.cs index 3aa3f3515f..92524056fd 100644 --- a/Core.Arango/Modules/Internal/ArangoQueryModule.cs +++ b/Core.Arango/Modules/Internal/ArangoQueryModule.cs @@ -16,7 +16,7 @@ internal ArangoQueryModule(IArangoContext context) : base(context) { } - public async Task> FindAsync(ArangoHandle database, string collection, FormattableString filter, + public async ValueTask> FindAsync(ArangoHandle database, string collection, FormattableString filter, string projection = null, int limit = 1000, CancellationToken cancellationToken = default) { var filterExp = Parameterize(filter, out var parameter); @@ -26,7 +26,7 @@ public async Task> FindAsync(ArangoHandle database, string collection parameter, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task SingleOrDefaultAsync(ArangoHandle database, string collection, FormattableString filter, + public async ValueTask SingleOrDefaultAsync(ArangoHandle database, string collection, FormattableString filter, string projection = null, CancellationToken cancellationToken = default) { var results = await FindAsync(database, collection, filter, projection, 2, cancellationToken) @@ -37,7 +37,7 @@ public async Task SingleOrDefaultAsync(ArangoHandle database, string colle return results.SingleOrDefault(); } - public async Task> ExecuteAsync(ArangoHandle database, FormattableString query, + public async ValueTask> ExecuteAsync(ArangoHandle database, FormattableString query, bool? cache = null, bool? fullCount = null, CancellationToken cancellationToken = default) { var queryExp = Parameterize(query, out var parameter); @@ -46,7 +46,7 @@ public async Task> ExecuteAsync(ArangoHandle database, Formatta .ConfigureAwait(false); } - public async Task> ExecuteAsync(ArangoHandle database, string query, + public async ValueTask> ExecuteAsync(ArangoHandle database, string query, IDictionary bindVars, bool? cache = null, bool? fullCount = null, CancellationToken cancellationToken = default) { @@ -102,7 +102,7 @@ public async Task> ExecuteAsync(ArangoHandle database, string q } } - public async Task ExecuteAsync(Type type, bool isEnumerable, ArangoHandle database, string query, + public async ValueTask ExecuteAsync(Type type, bool isEnumerable, ArangoHandle database, string query, IDictionary bindVars, bool? cache = null, bool? fullCount = null, CancellationToken cancellationToken = default) { @@ -207,7 +207,7 @@ public async IAsyncEnumerable ExecuteStreamAsync(ArangoHandle database, Ar } } - public Task ExplainAsync(ArangoHandle database, string query, + public ValueTask ExplainAsync(ArangoHandle database, string query, IDictionary bindVars, bool allPlans = false, CancellationToken cancellationToken = default) @@ -224,7 +224,7 @@ public Task ExplainAsync(ArangoHandle database, string quer }, cancellationToken: cancellationToken); } - public Task ExplainAsync(ArangoHandle database, FormattableString query, + public ValueTask ExplainAsync(ArangoHandle database, FormattableString query, bool allPlans = false, CancellationToken cancellationToken = default) { @@ -233,7 +233,7 @@ public Task ExplainAsync(ArangoHandle database, Formattable return ExplainAsync(database, queryExp, parameter, allPlans, cancellationToken); } - public Task ParseAsync(ArangoHandle database, string query, + public ValueTask ParseAsync(ArangoHandle database, string query, CancellationToken cancellationToken = default) { return SendAsync(database, HttpMethod.Post, ApiPath(database, "query"), diff --git a/Core.Arango/Modules/Internal/ArangoTransactionModule.cs b/Core.Arango/Modules/Internal/ArangoTransactionModule.cs index fa97183294..3864dc8dfb 100644 --- a/Core.Arango/Modules/Internal/ArangoTransactionModule.cs +++ b/Core.Arango/Modules/Internal/ArangoTransactionModule.cs @@ -12,7 +12,7 @@ internal ArangoTransactionModule(IArangoContext context) : base(context) { } - public async Task ExecuteAsync(ArangoHandle database, ArangoTransaction request, + public async ValueTask ExecuteAsync(ArangoHandle database, ArangoTransaction request, CancellationToken cancellationToken = default) { return await SendAsync(null, HttpMethod.Post, @@ -20,7 +20,7 @@ public async Task ExecuteAsync(ArangoHandle database, ArangoTransaction re request, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task BeginAsync(ArangoHandle database, ArangoTransaction request, + public async ValueTask BeginAsync(ArangoHandle database, ArangoTransaction request, CancellationToken cancellationToken = default) { var res = await SendAsync>(null, HttpMethod.Post, @@ -31,7 +31,7 @@ public async Task BeginAsync(ArangoHandle database, ArangoTransact return new ArangoHandle(database, transaction); } - public async Task CommitAsync(ArangoHandle database, + public async ValueTask CommitAsync(ArangoHandle database, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(database.Transaction)) @@ -42,7 +42,7 @@ await SendAsync(null, HttpMethod.Put, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task AbortAsync(ArangoHandle database, CancellationToken cancellationToken = default) + public async ValueTask AbortAsync(ArangoHandle database, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(database.Transaction)) throw new ArangoException("no transaction handle"); diff --git a/Core.Arango/Modules/Internal/ArangoUserModule.cs b/Core.Arango/Modules/Internal/ArangoUserModule.cs index d80ee13b03..4ac443af1b 100644 --- a/Core.Arango/Modules/Internal/ArangoUserModule.cs +++ b/Core.Arango/Modules/Internal/ArangoUserModule.cs @@ -16,7 +16,7 @@ internal ArangoUserModule(IArangoContext context) : base(context) /// /// Create a new user /// - public async Task CreateAsync(ArangoUser user, CancellationToken cancellationToken = default) + public async ValueTask CreateAsync(ArangoUser user, CancellationToken cancellationToken = default) { var res = await SendAsync(null, HttpMethod.Post, ApiPath("user"), user, cancellationToken: cancellationToken); @@ -27,7 +27,7 @@ public async Task CreateAsync(ArangoUser user, CancellationToken cancellat /// /// List available users /// - public async Task> ListAsync(CancellationToken cancellationToken = default) + public async ValueTask> ListAsync(CancellationToken cancellationToken = default) { var res = await SendAsync>(null, HttpMethod.Get, ApiPath("user"), cancellationToken: cancellationToken); @@ -37,7 +37,7 @@ public async Task> ListAsync(CancellationToken c /// /// Set the database access level /// - public async Task SetDatabaseAccessAsync(ArangoHandle handle, string user, ArangoAccess access, + public async ValueTask SetDatabaseAccessAsync(ArangoHandle handle, string user, ArangoAccess access, CancellationToken cancellationToken = default) { var res = await SendAsync(null, HttpMethod.Put, @@ -53,7 +53,7 @@ public async Task SetDatabaseAccessAsync(ArangoHandle handle, string user, /// /// Clear the database access level, revert back to the default access level /// - public async Task DeleteDatabaseAccessAsync(ArangoHandle handle, string user, + public async ValueTask DeleteDatabaseAccessAsync(ArangoHandle handle, string user, CancellationToken cancellationToken = default) { var res = await SendAsync(null, HttpMethod.Delete, @@ -66,7 +66,7 @@ public async Task DeleteDatabaseAccessAsync(ArangoHandle handle, string us /// /// Modify attributes of an existing user /// - public async Task PatchAsync(ArangoUser user, CancellationToken cancellationToken = default) + public async ValueTask PatchAsync(ArangoUser user, CancellationToken cancellationToken = default) { var res = await SendAsync(null, PolyfillHelper.Patch, ApiPath($"user/{UrlEncode(user.Name)}"), @@ -79,7 +79,7 @@ public async Task PatchAsync(ArangoUser user, CancellationToken cancellati /// /// Delete a user permanently. /// - public async Task DeleteAsync(string user, CancellationToken cancellationToken = default) + public async ValueTask DeleteAsync(string user, CancellationToken cancellationToken = default) { var res = await SendAsync(null, HttpMethod.Delete, ApiPath($"user/{UrlEncode(user)}"), cancellationToken: cancellationToken); diff --git a/Core.Arango/Modules/Internal/ArangoViewModule.cs b/Core.Arango/Modules/Internal/ArangoViewModule.cs index 030d62c802..d946693ac2 100644 --- a/Core.Arango/Modules/Internal/ArangoViewModule.cs +++ b/Core.Arango/Modules/Internal/ArangoViewModule.cs @@ -13,7 +13,7 @@ internal ArangoViewModule(IArangoContext context) : base(context) { } - public async Task CreateAsync(ArangoHandle database, ArangoView view, + public async ValueTask CreateAsync(ArangoHandle database, ArangoView view, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Post, @@ -22,7 +22,7 @@ await SendAsync(database, HttpMethod.Post, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task UpdateAsync(ArangoHandle database, ArangoViewUpdate view, CancellationToken cancellationToken = default) + public async ValueTask UpdateAsync(ArangoHandle database, ArangoViewUpdate view, CancellationToken cancellationToken = default) { await SendAsync(database, HttpMethod.Put, ApiPath(database, $"view/{UrlEncode(view.Name)}/properties"), @@ -30,7 +30,7 @@ await SendAsync(database, HttpMethod.Put, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task PatchAsync(ArangoHandle database, ArangoViewPatch view, CancellationToken cancellationToken = default) + public async ValueTask PatchAsync(ArangoHandle database, ArangoViewPatch view, CancellationToken cancellationToken = default) { await SendAsync(database, PolyfillHelper.Patch, ApiPath(database, $"view/{UrlEncode(view.Name)}/properties"), @@ -38,7 +38,7 @@ await SendAsync(database, PolyfillHelper.Patch, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task> ListAsync(ArangoHandle database, + public async ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default) { var res = await SendAsync>(database, HttpMethod.Get, @@ -47,7 +47,7 @@ public async Task> ListAsync(ArangoHa return res.Result; } - public async Task GetPropertiesAsync(ArangoHandle database, string view, + public async ValueTask GetPropertiesAsync(ArangoHandle database, string view, CancellationToken cancellationToken = default) { var res = await SendAsync(database, HttpMethod.Get, @@ -56,7 +56,7 @@ public async Task GetPropertiesAsync(ArangoHandle database, string v return res; } - public async Task DropAsync(ArangoHandle database, + public async ValueTask DropAsync(ArangoHandle database, string name, CancellationToken cancellationToken = default) { @@ -65,7 +65,7 @@ await SendAsync(database, HttpMethod.Delete, cancellationToken: cancellationToken).ConfigureAwait(false); } - public async Task DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default) + public async ValueTask DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default) { var views = await ListAsync(database, cancellationToken).ConfigureAwait(false); diff --git a/Core.Arango/Transport/ArangoHttpTransport.cs b/Core.Arango/Transport/ArangoHttpTransport.cs index 304c98b912..134599c33f 100644 --- a/Core.Arango/Transport/ArangoHttpTransport.cs +++ b/Core.Arango/Transport/ArangoHttpTransport.cs @@ -35,7 +35,7 @@ public ArangoHttpTransport(IArangoConfiguration configuration) } /// - public async Task SendAsync(HttpMethod m, string url, object body = null, + public async ValueTask SendAsync(HttpMethod m, string url, object body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default) @@ -87,7 +87,7 @@ public async Task SendAsync(HttpMethod m, string url, object body = null, } /// - public async Task SendContentAsync(HttpMethod m, string url, HttpContent body = null, + public async ValueTask SendContentAsync(HttpMethod m, string url, HttpContent body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default) @@ -113,7 +113,7 @@ public async Task SendContentAsync(HttpMethod m, string url, HttpCo } /// - public async Task SendAsync(Type type, HttpMethod m, string url, object body = null, + public async ValueTask SendAsync(Type type, HttpMethod m, string url, object body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default) @@ -170,7 +170,7 @@ private void ApplyHeaders(string transaction, bool auth, HttpRequestMessage msg, msg.Headers.Add(header.Key, header.Value); } - private async Task Authenticate(bool auth, CancellationToken cancellationToken) + private async ValueTask Authenticate(bool auth, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(_configuration.User)) return; diff --git a/Core.Arango/Transport/IArangoTransport.cs b/Core.Arango/Transport/IArangoTransport.cs index f16f2e0318..8062510694 100644 --- a/Core.Arango/Transport/IArangoTransport.cs +++ b/Core.Arango/Transport/IArangoTransport.cs @@ -14,21 +14,21 @@ public interface IArangoTransport /// /// Send request to ArangoDB /// - Task SendAsync(Type type, HttpMethod m, string url, object body = null, string transaction = null, + ValueTask SendAsync(Type type, HttpMethod m, string url, object body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default); /// /// Send request to ArangoDB /// - Task SendAsync(HttpMethod m, string url, object body = null, string transaction = null, + ValueTask SendAsync(HttpMethod m, string url, object body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default); /// /// Send raw HTTP content request to ArangoDB /// - Task SendContentAsync(HttpMethod m, string url, HttpContent body = null, string transaction = null, + ValueTask SendContentAsync(HttpMethod m, string url, HttpContent body = null, string transaction = null, bool throwOnError = true, bool auth = true, IDictionary headers = null, CancellationToken cancellationToken = default); }