forked from parse-community/Parse-SDK-dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIParseObjectCurrentController.cs
More file actions
52 lines (45 loc) · 2.04 KB
/
Copy pathIParseObjectCurrentController.cs
File metadata and controls
52 lines (45 loc) · 2.04 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
using System.Threading;
using System.Threading.Tasks;
using Parse.Abstractions.Infrastructure;
namespace Parse.Abstractions.Platform.Objects;
/// <summary>
/// <code>IParseObjectCurrentController</code> controls the single-instance <see cref="ParseObject"/>
/// persistence used throughout the code-base. Sample usages are <see cref="ParseUser.CurrentUser"/> and
/// <see cref="ParseInstallation.CurrentInstallation"/>.
/// </summary>
/// <typeparam name="T">Type of object being persisted.</typeparam>
public interface IParseObjectCurrentController<T> where T : ParseObject
{
/// <summary>
/// Persists current <see cref="ParseObject"/>.
/// </summary>
/// <param name="obj"><see cref="ParseObject"/> to be persisted.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task SetAsync(T obj, CancellationToken cancellationToken = default);
/// <summary>
/// Gets the persisted current <see cref="ParseObject"/>.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
Task<T> GetAsync(IServiceHub serviceHub, CancellationToken cancellationToken = default);
/// <summary>
/// Returns a <see cref="Task"/> that resolves to <code>true</code> if current
/// <see cref="ParseObject"/> exists.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> ExistsAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Returns <code>true</code> if the given <see cref="ParseObject"/> is the persisted current
/// <see cref="ParseObject"/>.
/// </summary>
/// <param name="obj">The object to check.</param>
/// <returns>true if <code>obj</code> is the current persisted <see cref="ParseObject"/>.</returns>
bool IsCurrent(T obj);
/// <summary>
/// Nullifies the current <see cref="ParseObject"/> from memory.
/// </summary>
void ClearFromMemory();
/// <summary>
/// Clears current <see cref="ParseObject"/> from disk.
/// </summary>
Task ClearFromDiskAsync();
}