From 5f76434c98ab0e45447e947c4489ec644f93439a Mon Sep 17 00:00:00 2001 From: vnugent Date: Tue, 1 Aug 2023 18:39:13 -0400 Subject: Latest updates, build configurations, and native compression --- .../src/Abstractions/IDataStore.cs | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'lib/VNLib.Plugins.Extensions.Data/src/Abstractions/IDataStore.cs') diff --git a/lib/VNLib.Plugins.Extensions.Data/src/Abstractions/IDataStore.cs b/lib/VNLib.Plugins.Extensions.Data/src/Abstractions/IDataStore.cs index 4e2d682..1c8174c 100644 --- a/lib/VNLib.Plugins.Extensions.Data/src/Abstractions/IDataStore.cs +++ b/lib/VNLib.Plugins.Extensions.Data/src/Abstractions/IDataStore.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2022 Vaughn Nugent +* Copyright (c) 2023 Vaughn Nugent * * Library: VNLib * Package: VNLib.Plugins.Extensions.Data @@ -23,11 +23,13 @@ */ using System; +using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using VNLib.Utils; + namespace VNLib.Plugins.Extensions.Data.Abstractions { /// @@ -40,20 +42,23 @@ namespace VNLib.Plugins.Extensions.Data.Abstractions /// /// Gets the total number of records in the current store /// + /// A cancellation token to cancel the operation /// A task that resolves the number of records in the store - Task GetCountAsync(); + Task GetCountAsync(CancellationToken cancellation = default); /// /// Gets the number of records that belong to the specified constraint /// /// A specifier to constrain the reults + /// A cancellation token to cancel the operation /// The number of records that belong to the specifier - Task GetCountAsync(string specifier); + Task GetCountAsync(string specifier, CancellationToken cancellation = default); /// /// Gets a record from its key /// /// The key identifying the unique record + /// A cancellation token to cancel the operation /// A promise that resolves the record identified by the specified key - Task GetSingleAsync(string key); + Task GetSingleAsync(string key, CancellationToken cancellation = default); /// /// Gets a record from its key /// @@ -64,16 +69,18 @@ namespace VNLib.Plugins.Extensions.Data.Abstractions /// Gets a record from the store with a partial model, intended to complete the model /// /// The partial model used to query the store + /// A cancellation token to cancel the operation /// A task the resolves the completed data-model - Task GetSingleAsync(T record); + Task GetSingleAsync(T record, CancellationToken cancellation = default); /// /// Fills a collection with enires retireved from the store using the specifer /// /// The collection to add entires to /// A specifier argument to constrain results /// The maximum number of elements to retrieve + /// A cancellation token to cancel the operation /// A Task the resolves to the number of items added to the collection - Task GetCollectionAsync(ICollection collection, string specifier, int limit); + Task GetCollectionAsync(ICollection collection, string specifier, int limit, CancellationToken cancellation = default); /// /// Fills a collection with enires retireved from the store using a variable length specifier /// parameter @@ -87,26 +94,30 @@ namespace VNLib.Plugins.Extensions.Data.Abstractions /// Updates an entry in the store with the specified record /// /// The record to update + /// A cancellation token to cancel the operation /// A task the resolves an error code (should evaluate to false on failure, and true on success) - Task UpdateAsync(T record); + Task UpdateAsync(T record, CancellationToken cancellation = default); /// /// Creates a new entry in the store representing the specified record /// /// The record to add to the store + /// A cancellation token to cancel the operation /// A task the resolves an error code (should evaluate to false on failure, and true on success) - Task CreateAsync(T record); + Task CreateAsync(T record, CancellationToken cancellation = default); /// /// Deletes one or more entrires from the store matching the specified record /// /// The record to remove from the store + /// A cancellation token to cancel the operation /// A task the resolves the number of records removed(should evaluate to false on failure, and deleted count on success) - Task DeleteAsync(T record); + Task DeleteAsync(T record, CancellationToken cancellation = default); /// /// Deletes one or more entires from the store matching the specified unique key /// /// The unique key that identifies the record + /// A cancellation token to cancel the operation /// A task the resolves the number of records removed(should evaluate to false on failure, and deleted count on success) - Task DeleteAsync(string key); + Task DeleteAsync(string key, CancellationToken cancellation = default); /// /// Deletes one or more entires from the store matching the supplied specifiers /// @@ -117,7 +128,8 @@ namespace VNLib.Plugins.Extensions.Data.Abstractions /// Updates an entry in the store if it exists, or creates a new entry if one does not already exist /// /// The record to add to the store + /// A cancellation token to cancel the operation /// A task the resolves the result of the operation - Task AddOrUpdateAsync(T record); + Task AddOrUpdateAsync(T record, CancellationToken cancellation = default); } } -- cgit