aboutsummaryrefslogtreecommitdiff
path: root/VNLib.Plugins.Extensions.Data/Abstractions/IBulkDataStore.cs
blob: 3b6ab622662098fd912762d176a2a8a21cdcde44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections.Generic;
using System.Threading.Tasks;

using VNLib.Utils;

namespace VNLib.Plugins.Extensions.Data.Abstractions
{
    /// <summary>
    /// An abstraction that defines a Data-Store that supports 
    /// bulk data operations
    /// </summary>
    /// <typeparam name="T">The data-model type</typeparam>
    public interface IBulkDataStore<T>
    {
        /// <summary>
        /// Deletes a collection of records from the store
        /// </summary>
        /// <param name="records">A collection of records to delete</param>
        ///<returns>A task the resolves the number of entires removed from the store</returns>
        Task<ERRNO> DeleteBulkAsync(ICollection<T> records);
        /// <summary>
        /// Updates a collection of records
        /// </summary>
        /// <param name="records">The collection of records to update</param>
        /// <returns>A task the resolves an error code (should evaluate to false on failure, and true on success)</returns>
        Task<ERRNO> UpdateBulkAsync(ICollection<T> records);
        /// <summary>
        /// Creates a bulk collection of records as entries in the store
        /// </summary>
        /// <param name="records">The collection of records to add</param>
        /// <returns>A task the resolves an error code (should evaluate to false on failure, and true on success)</returns>
        Task<ERRNO> CreateBulkAsync(ICollection<T> records);
        /// <summary>
        /// Creates or updates individual records from a bulk collection of records
        /// </summary>
        /// <param name="records">The collection of records to add</param>
        /// <returns>A task the resolves an error code (should evaluate to false on failure, and true on success)</returns>
        Task<ERRNO> AddOrUpdateBulkAsync(ICollection<T> records);
    }
    
}