From c9f13c9d76774dbf3dd650718b58ad6926e1e413 Mon Sep 17 00:00:00 2001 From: Harry Cordewener Date: Fri, 15 Nov 2024 17:38:58 -0500 Subject: [PATCH] Use ValueTask to go Faster. --- Core.Arango.Tests/FoxxTest.cs | 4 +-- Core.Arango.Tests/TransactionTest.cs | 2 +- Core.Arango/ArangoContext.cs | 4 +-- Core.Arango/IArangoContext.cs | 4 +-- Core.Arango/Linq/ArangoQueryExtensions.cs | 22 ++++++------ Core.Arango/Linq/Interface/IArangoLinq.cs | 2 +- Core.Arango/Linq/Internal/ArangoLinq.cs | 2 +- Core.Arango/Linq/Query/ArangoQueryable.cs | 10 +++--- Core.Arango/Modules/IArangoAnalyzerModule.cs | 4 +-- Core.Arango/Modules/IArangoBackupModule.cs | 4 +-- .../Modules/IArangoCollectionModule.cs | 6 ++-- Core.Arango/Modules/IArangoDatabaseModule.cs | 10 +++--- Core.Arango/Modules/IArangoDocumentModule.cs | 32 ++++++++--------- Core.Arango/Modules/IArangoFoxxModule.cs | 36 +++++++++---------- Core.Arango/Modules/IArangoFunctionModule.cs | 6 ++-- Core.Arango/Modules/IArangoGraphEdgeModule.cs | 18 +++++----- Core.Arango/Modules/IArangoGraphModule.cs | 4 +-- .../Modules/IArangoGraphVertexModule.cs | 18 +++++----- Core.Arango/Modules/IArangoIndexModule.cs | 2 +- Core.Arango/Modules/IArangoPregelModule.cs | 4 +-- Core.Arango/Modules/IArangoQueryModule.cs | 16 ++++----- .../Modules/IArangoTransactionModule.cs | 4 +-- Core.Arango/Modules/IArangoUserModule.cs | 12 +++---- Core.Arango/Modules/IArangoViewModule.cs | 4 +-- .../Modules/Internal/ArangoAnalyzerModule.cs | 4 +-- .../Modules/Internal/ArangoBackupModule.cs | 4 +-- .../Internal/ArangoCollectionModule.cs | 6 ++-- .../Modules/Internal/ArangoDatabaseModule.cs | 10 +++--- .../Modules/Internal/ArangoDocumentModule.cs | 32 ++++++++--------- .../Modules/Internal/ArangoFoxxModule.cs | 36 +++++++++---------- .../Modules/Internal/ArangoFunctionModule.cs | 6 ++-- .../Modules/Internal/ArangoGraphEdgeModule.cs | 18 +++++----- .../Modules/Internal/ArangoGraphModule.cs | 4 +-- .../Internal/ArangoGraphVertexModule.cs | 18 +++++----- .../Modules/Internal/ArangoIndexModule.cs | 2 +- Core.Arango/Modules/Internal/ArangoModule.cs | 4 +-- .../Modules/Internal/ArangoPregelModule.cs | 4 +-- .../Modules/Internal/ArangoQueryModule.cs | 16 ++++----- .../Internal/ArangoTransactionModule.cs | 4 +-- .../Modules/Internal/ArangoUserModule.cs | 12 +++---- .../Modules/Internal/ArangoViewModule.cs | 4 +-- Core.Arango/Transport/ArangoHttpTransport.cs | 6 ++-- Core.Arango/Transport/IArangoTransport.cs | 6 ++-- 43 files changed, 213 insertions(+), 213 deletions(-) diff --git a/Core.Arango.Tests/FoxxTest.cs b/Core.Arango.Tests/FoxxTest.cs index 3b8fd1c2f3..514efaf56e 100644 --- a/Core.Arango.Tests/FoxxTest.cs +++ b/Core.Arango.Tests/FoxxTest.cs @@ -38,7 +38,7 @@ await Arango.Foxx.InstallServiceAsync("test", "/sample/service", ArangoFoxxSourc Assert.Equal("/sample/service", services.First().Mount); } - private async Task BuildService(string response) + private async ValueTask BuildService(string response) { var ms = new MemoryStream(); using (var zip = new ZipArchive(ms, ZipArchiveMode.Create, true, Encoding.UTF8)) @@ -110,7 +110,7 @@ await Arango.Foxx.InstallServiceAsync("test", "/sample/service", await Arango.Foxx.ReplaceConfigurationAsync("test", "/sample/service", new { - currency = "�", + currency = "�", secretKey = "s3cr3t" }); 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..20aa7de1dc 100644 --- a/Core.Arango/Modules/IArangoAnalyzerModule.cs +++ b/Core.Arango/Modules/IArangoAnalyzerModule.cs @@ -28,13 +28,13 @@ Task DeleteAsync(ArangoHandle database, string analyzer, bool force = false, /// /// 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..6edf1e0754 100644 --- a/Core.Arango/Modules/IArangoBackupModule.cs +++ b/Core.Arango/Modules/IArangoBackupModule.cs @@ -13,7 +13,7 @@ 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. @@ -28,6 +28,6 @@ public interface IArangoBackupModule /// /// 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..3a7c6fac92 100644 --- a/Core.Arango/Modules/IArangoCollectionModule.cs +++ b/Core.Arango/Modules/IArangoCollectionModule.cs @@ -25,7 +25,7 @@ Task CreateAsync(ArangoHandle database, string collection, ArangoCollectionType /// /// Returns all collections /// - Task> ListAsync(ArangoHandle database, + ValueTask> ListAsync(ArangoHandle database, CancellationToken cancellationToken = default); /// @@ -55,13 +55,13 @@ Task DropAsync(ArangoHandle database, string collection, /// /// 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); /// diff --git a/Core.Arango/Modules/IArangoDatabaseModule.cs b/Core.Arango/Modules/IArangoDatabaseModule.cs index 1f69a3de06..19615bdeb4 100644 --- a/Core.Arango/Modules/IArangoDatabaseModule.cs +++ b/Core.Arango/Modules/IArangoDatabaseModule.cs @@ -13,17 +13,17 @@ 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 @@ -33,11 +33,11 @@ public interface IArangoDatabaseModule /// /// 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..965d7be997 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); @@ -143,7 +143,7 @@ Task ImportAsync(ArangoHandle database, string collection, IEnumerable doc /// /// 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..e343218efc 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); @@ -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..7b579ed4cd 100644 --- a/Core.Arango/Modules/IArangoGraphModule.cs +++ b/Core.Arango/Modules/IArangoGraphModule.cs @@ -33,13 +33,13 @@ public interface IArangoGraphModule /// /// 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. 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..0452d0ef77 100644 --- a/Core.Arango/Modules/IArangoIndexModule.cs +++ b/Core.Arango/Modules/IArangoIndexModule.cs @@ -29,7 +29,7 @@ Task CreateAsync(ArangoHandle database, string collection, ArangoIndex request, /// /// 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..907173ea7a 100644 --- a/Core.Arango/Modules/IArangoPregelModule.cs +++ b/Core.Arango/Modules/IArangoPregelModule.cs @@ -12,13 +12,13 @@ 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); /// 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..ca5b47560c 100644 --- a/Core.Arango/Modules/IArangoTransactionModule.cs +++ b/Core.Arango/Modules/IArangoTransactionModule.cs @@ -12,7 +12,7 @@ public interface IArangoTransactionModule /// /// Begin a server-side transaction /// - Task BeginAsync(ArangoHandle database, ArangoTransaction request, + ValueTask BeginAsync(ArangoHandle database, ArangoTransaction request, CancellationToken cancellationToken = default); /// @@ -28,7 +28,7 @@ Task BeginAsync(ArangoHandle database, ArangoTransaction request, /// /// 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..fb1453fe76 100644 --- a/Core.Arango/Modules/IArangoViewModule.cs +++ b/Core.Arango/Modules/IArangoViewModule.cs @@ -40,7 +40,7 @@ public interface IArangoViewModule /// /// 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..4514fe2f6e 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, diff --git a/Core.Arango/Modules/Internal/ArangoBackupModule.cs b/Core.Arango/Modules/Internal/ArangoBackupModule.cs index fb38690d44..3db2539410 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", @@ -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..3ac3d4e9d9 100644 --- a/Core.Arango/Modules/Internal/ArangoCollectionModule.cs +++ b/Core.Arango/Modules/Internal/ArangoCollectionModule.cs @@ -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, @@ -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); @@ -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( diff --git a/Core.Arango/Modules/Internal/ArangoDatabaseModule.cs b/Core.Arango/Modules/Internal/ArangoDatabaseModule.cs index ec4782c8c8..8199752ea7 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,7 +62,7 @@ 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; diff --git a/Core.Arango/Modules/Internal/ArangoDocumentModule.cs b/Core.Arango/Modules/Internal/ArangoDocumentModule.cs index f1970b6858..34a0a9bc4a 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, @@ -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..2c2e794a61 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) { @@ -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..99408397b4 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, 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..415a63f5d6 100644 --- a/Core.Arango/Modules/Internal/ArangoIndexModule.cs +++ b/Core.Arango/Modules/Internal/ArangoIndexModule.cs @@ -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, 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..112d28ad2a 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, 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..3139e3e372 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, 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..f5a16537e6 100644 --- a/Core.Arango/Modules/Internal/ArangoViewModule.cs +++ b/Core.Arango/Modules/Internal/ArangoViewModule.cs @@ -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, diff --git a/Core.Arango/Transport/ArangoHttpTransport.cs b/Core.Arango/Transport/ArangoHttpTransport.cs index 304c98b912..b363826a77 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) 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); }