/
IManagementGrain.cs
121 lines (110 loc) · 6.84 KB
/
IManagementGrain.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
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
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Orleans.Runtime.Configuration;
using Orleans.MultiCluster;
using Orleans.Versions.Compatibility;
using Orleans.Versions.Selector;
namespace Orleans.Runtime
{
/// <summary>
/// Interface for system management functions of silos,
/// exposed as a grain for receiving remote requests / commands.
/// </summary>
public interface IManagementGrain : IGrainWithIntegerKey, IVersionManager
{
/// <summary>
/// Get the list of silo hosts and statuses currently known about in this cluster.
/// </summary>
/// <param name="onlyActive">Whether data on just current active silos should be returned,
/// or by default data for all current and previous silo instances [including those in Joining or Dead status].</param>
/// <returns></returns>
Task<Dictionary<SiloAddress, SiloStatus>> GetHosts(bool onlyActive = false);
/// <summary>
/// Get the list of silo hosts and membership information currently known about in this cluster.
/// </summary>
/// <param name="onlyActive">Whether data on just current active silos should be returned,
/// or by default data for all current and previous silo instances [including those in Joining or Dead status].</param>
/// <returns></returns>
Task<MembershipEntry[]> GetDetailedHosts(bool onlyActive = false);
/// <summary>
/// Perform a run of the .NET garbage collector in the specified silos.
/// </summary>
/// <param name="hostsIds">List of silos this command is to be sent to.</param>
/// <returns>Completion promise for this operation.</returns>
Task ForceGarbageCollection(SiloAddress[] hostsIds);
/// <summary>Perform a run of the Orleans activation collecter in the specified silos.</summary>
/// <param name="hostsIds">List of silos this command is to be sent to.</param>
/// <param name="ageLimit">Maximum idle time of activations to be collected.</param>
/// <returns>Completion promise for this operation.</returns>
Task ForceActivationCollection(SiloAddress[] hostsIds, TimeSpan ageLimit);
Task ForceActivationCollection(TimeSpan ageLimit);
/// <summary>Perform a run of the silo statistics collector in the specified silos.</summary>
/// <param name="siloAddresses">List of silos this command is to be sent to.</param>
/// <returns>Completion promise for this operation.</returns>
Task ForceRuntimeStatisticsCollection(SiloAddress[] siloAddresses);
/// <summary>
/// Return the most recent silo runtime statistics information for the specified silos.
/// </summary>
/// <param name="hostsIds">List of silos this command is to be sent to.</param>
/// <returns>Completion promise for this operation.</returns>
Task<SiloRuntimeStatistics[]> GetRuntimeStatistics(SiloAddress[] hostsIds);
/// <summary>
/// Return the most recent grain statistics information, amalgamated across silos.
/// </summary>
/// <param name="hostsIds">List of silos this command is to be sent to.</param>
/// <returns>Completion promise for this operation.</returns>
Task<SimpleGrainStatistic[]> GetSimpleGrainStatistics(SiloAddress[] hostsIds);
/// <summary>
/// Return the most recent grain statistics information, amalgamated across all silos.
/// </summary>
/// <returns>Completion promise for this operation.</returns>
Task<SimpleGrainStatistic[]> GetSimpleGrainStatistics();
/// <summary>
/// Returns the most recent detailed grain statistics information, amalgamated across silos for the specified types.
/// </summary>
/// <param name="hostsIds">List of silos this command is to be sent to.</param>
/// <param name="types">Array of grain types to filter the results with</param>
/// <returns></returns>
Task<DetailedGrainStatistic[]> GetDetailedGrainStatistics(string[] types = null, SiloAddress[] hostsIds = null);
Task<int> GetGrainActivationCount(GrainReference grainReference);
/// <summary>
/// Return the total count of all current grain activations across all silos.
/// </summary>
/// <returns>Completion promise for this operation.</returns>
///
Task<int> GetTotalActivationCount();
/// <summary>
/// Execute a control command on the specified providers on all silos in the cluster.
/// Commands are sent to all known providers on each silo which match both the <c>providerTypeFullName</c> AND <c>providerName</c> parameters.
/// </summary>
/// <remarks>
/// Providers must implement the <c>Orleans.Providers.IControllable</c>
/// interface in order to receive these control channel commands.
/// </remarks>
/// <param name="providerTypeFullName">Class full name for the provider type to send this command to.</param>
/// <param name="providerName">Provider name to send this command to.</param>
/// <param name="command">An id / serial number of this command.
/// This is an opaque value to the Orleans runtime - the control protocol semantics are decided between the sender and provider.</param>
/// <param name="arg">An opaque command argument.
/// This is an opaque value to the Orleans runtime - the control protocol semantics are decided between the sender and provider.</param>
/// <returns>Completion promise for this operation.</returns>
Task<object[]> SendControlCommandToProvider(string providerTypeFullName, string providerName, int command, object arg = null);
/// <summary>
/// Returns an array of all the active grain types in the system
/// </summary>
/// <param name="hostsIds">List of silos this command is to be sent to.</param>
/// <returns></returns>
Task<string[]> GetActiveGrainTypes(SiloAddress[] hostsIds=null);
/// <summary>
/// Return the <see cref="Orleans.Runtime.SiloAddress"/> where a given Grain is activated (if any).
/// </summary>
/// <remarks>
/// Please note that this method does not represent a strong consistent view of the Grain Catalog.
/// The return of this method is taken based on a last known state of the grain which may or may not be up-to-date by the time the caller receive the request.
/// </remarks>
/// <param name="reference">The <see cref="Orleans.Runtime.IAddressable"/> to look up.</param>
/// <returns>The <see cref="Orleans.Runtime.SiloAddress"/> where the Grain is activated or null if not activated taken from a snapshot of the last known state of the Grain Catalog.</returns>
ValueTask<SiloAddress> GetActivationAddress(IAddressable reference);
}
}