blob: 0a2e4a8a6a10ba15d521b476828c668a1ba81c1b (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
* Copyright (c) 2022 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Plugins.Extensions.Data
* File: IBulkDataStore.cs
*
* IBulkDataStore.cs is part of VNLib.Plugins.Extensions.Data which is part of the larger
* VNLib collection of libraries and utilities.
*
* VNLib.Plugins.Extensions.Data is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* VNLib.Plugins.Extensions.Data is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
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);
}
}
|