-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIAdapter.cs
90 lines (77 loc) · 3.04 KB
/
IAdapter.cs
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
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using DataCore.Adapter.Common;
namespace DataCore.Adapter {
/// <summary>
/// Describes an App Store Connect adapter.
/// </summary>
/// <remarks>
/// Implementers should inherit from <see cref="AdapterCore"/> or a another derived type
/// rather than implementing <see cref="IAdapter"/> directly.
/// </remarks>
/// <seealso cref="AdapterCore"/>
public interface IAdapter : IBackgroundTaskServiceProvider, IDisposable, IAsyncDisposable {
/// <summary>
/// Gets the adapter descriptor.
/// </summary>
AdapterDescriptor Descriptor { get; }
/// <summary>
/// Gets the adapter type descriptor.
/// </summary>
AdapterTypeDescriptor TypeDescriptor { get; }
/// <summary>
/// Gets the feature collection for the adapter.
/// </summary>
IAdapterFeaturesCollection Features { get; }
/// <summary>
/// Gets additional properties associated with the adapter.
/// </summary>
IEnumerable<AdapterProperty> Properties { get; }
/// <summary>
/// Gets a flag indicating if the adapter is enabled.
/// </summary>
bool IsEnabled { get; }
/// <summary>
/// Gets a flag indicating if the adapter has been started.
/// </summary>
bool IsRunning { get; }
/// <summary>
/// Raised when the adapter is started.
/// </summary>
event Func<IAdapter, Task>? Started;
/// <summary>
/// Raised when the adapter is stopped.
/// </summary>
event Func<IAdapter, Task>? Stopped;
/// <summary>
/// Starts the adapter.
/// </summary>
/// <param name="cancellationToken">
/// The cancellation token for the operation.
/// </param>
/// <returns>
/// A <see cref="Task"/> that represents the start operation.
/// </returns>
Task StartAsync(CancellationToken cancellationToken);
/// <summary>
/// Shuts down the adapter.
/// </summary>
/// <param name="cancellationToken">
/// The cancellation token for the operation.
/// </param>
/// <returns>
/// A <see cref="Task"/> that represents the stop operation.
/// </returns>
/// <remarks>
/// The <see cref="StopAsync"/> method is intended to allow the same adapter to be
/// started and stopped multiple times. Therefore, only resources that are created
/// when <see cref="StartAsync"/> is called should be disposed when <see cref="StopAsync"/>
/// is called. The <see cref="IDisposable.Dispose"/> and <see cref="IAsyncDisposable.DisposeAsync"/>
/// methods should be used to dispose of all resources, including those created by
/// calls to <see cref="StartAsync"/>.
/// </remarks>
Task StopAsync(CancellationToken cancellationToken);
}
}