-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathIStorageOperations.cs
More file actions
153 lines (132 loc) · 10.3 KB
/
Copy pathIStorageOperations.cs
File metadata and controls
153 lines (132 loc) · 10.3 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using ManagedCode.Communication;
using ManagedCode.Storage.Core.Models;
namespace ManagedCode.Storage.Core;
public interface IStorageOperations
{
/// <summary>
/// Asynchronously deletes a file.
/// </summary>
/// <param name="fileName">The name of the file to delete.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the success of the operation.</returns>
Task<Result<bool>> DeleteAsync(string fileName, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously deletes a file with the provided delete options.
/// </summary>
/// <param name="options">The options to use when deleting the file.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the success of the operation.</returns>
Task<Result<bool>> DeleteAsync(DeleteOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously deletes a file with the provided delete options.
/// </summary>
/// <param name="action">An action that configures the delete options.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the success of the operation.</returns>
Task<Result<bool>> DeleteAsync(Action<DeleteOptions> action, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously checks if a file exists.
/// </summary>
/// <param name="fileName">The name of the file to check.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the existence of the file.</returns>
Task<Result<bool>> ExistsAsync(string fileName, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously checks if a file exists with the provided exist options.
/// </summary>
/// <param name="options">The options to use when checking the file existence.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the existence of the file.</returns>
Task<Result<bool>> ExistsAsync(ExistOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously checks if a file exists with the provided exist options.
/// </summary>
/// <param name="action">An action that configures the exist options.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the existence of the file.</returns>
Task<Result<bool>> ExistsAsync(Action<ExistOptions> action, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously retrieves the metadata of a file.
/// </summary>
/// <param name="fileName">The name of the file to retrieve metadata from.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with the BlobMetadata of the file.</returns>
Task<Result<BlobMetadata>> GetBlobMetadataAsync(string fileName, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously retrieves the metadata of a file with the provided metadata options.
/// </summary>
/// <param name="options">The options to use when retrieving the file metadata.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with the BlobMetadata of the file.</returns>
Task<Result<BlobMetadata>> GetBlobMetadataAsync(MetadataOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously retrieves the metadata of a file with the provided metadata options.
/// </summary>
/// <param name="action">An action that configures the metadata options.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with the BlobMetadata of the file.</returns>
Task<Result<BlobMetadata>> GetBlobMetadataAsync(Action<MetadataOptions> action, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously retrieves a list of BlobMetadata for all files in the specified directory.
/// </summary>
/// <param name="directory">The directory to retrieve the BlobMetadata from. If null, retrieves from all directories.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>An IAsyncEnumerable that can be used to iterate over the BlobMetadata objects.</returns>
IAsyncEnumerable<BlobMetadata> GetBlobMetadataListAsync(string? directory = null, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously deletes a directory.
/// </summary>
/// <param name="directory">The name of the directory to delete.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object indicating the success of the operation.</returns>
Task<Result> DeleteDirectoryAsync(string directory, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously sets the legal hold status for a file.
/// </summary>
/// <param name="hasLegalHold">The legal hold status to set.</param>
/// <param name="fileName">The name of the file to set the legal hold status for.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object indicating the success of the operation.</returns>
Task<Result> SetLegalHoldAsync(bool hasLegalHold, string fileName, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously sets the legal hold status for a file with the provided legal hold options.
/// </summary>
/// <param name="hasLegalHold">The legal hold status to set.</param>
/// <param name="options">The options to use when setting the legal hold status.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object indicating the success of the operation.</returns>
Task<Result> SetLegalHoldAsync(bool hasLegalHold, LegalHoldOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously sets the legal hold status for a file with the provided legal hold options.
/// </summary>
/// <param name="hasLegalHold">The legal hold status to set.</param>
/// <param name="action">An action that configures the legal hold options.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object indicating the success of the operation.</returns>
Task<Result> SetLegalHoldAsync(bool hasLegalHold, Action<LegalHoldOptions> action, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously checks if a file has a legal hold.
/// </summary>
/// <param name="fileName">The name of the file to check.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the legal hold status of the file.</returns>
Task<Result<bool>> HasLegalHoldAsync(string fileName, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously checks if a file has a legal hold with the provided legal hold options.
/// </summary>
/// <param name="options">The options to use when checking the legal hold status.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the legal hold status of the file.</returns>
Task<Result<bool>> HasLegalHoldAsync(LegalHoldOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously checks if a file has a legal hold with the provided legal hold options.
/// </summary>
/// <param name="action">An action that configures the legal hold options.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a Result object with a boolean indicating the legal hold status of the file.</returns>
Task<Result<bool>> HasLegalHoldAsync(Action<LegalHoldOptions> action, CancellationToken cancellationToken = default);
}