-
Notifications
You must be signed in to change notification settings - Fork 349
/
OrleansService.cs
91 lines (77 loc) · 2.83 KB
/
OrleansService.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Aspire.Hosting.ApplicationModel;
namespace Aspire.Hosting.Orleans;
/// <summary>
/// Describes an Orleans service.
/// </summary>
public sealed class OrleansService
{
/// <summary>Initializes a new <see cref="OrleansService"/> instance.</summary>
/// <param name="builder">The distributed application builder.</param>
/// <param name="name">The service name.</param>
public OrleansService(IDistributedApplicationBuilder builder, string name)
{
Name = name;
Builder = builder;
ServiceId = ParameterResourceBuilderExtensions.CreateGeneratedParameter(builder, $"{name}-service-id", secret: false, new GenerateParameterDefault
{
Upper = false,
Special = false,
MinLength = 25
});
ClusterId = ParameterResourceBuilderExtensions.CreateGeneratedParameter(builder, $"{name}-cluster-id", secret: false, new GenerateParameterDefault
{
Upper = false,
Special = false,
MinLength = 25
});
}
/// <summary>
/// Gets the name of the service.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the distributed application builder.
/// </summary>
public IDistributedApplicationBuilder Builder { get; }
/// <summary>
/// Gets or sets the service identifier.
/// </summary>
internal object ServiceId { get; set; }
/// <summary>
/// Gets or sets the cluster identifier.
/// </summary>
internal object ClusterId { get; set; }
/// <summary>
/// Gets or sets the clustering provider.
/// </summary>
public IProviderConfiguration? Clustering { get; set; }
/// <summary>
/// Gets or sets the reminder service provider.
/// </summary>
public IProviderConfiguration? Reminders { get; set; }
/// <summary>
/// Gets the grain storage providers.
/// </summary>
public Dictionary<string, IProviderConfiguration> GrainStorage { get; } = [];
/// <summary>
/// Gets the grain directory providers.
/// </summary>
public Dictionary<string, IProviderConfiguration> GrainDirectory { get; } = [];
/// <summary>
/// Gets the broadcast channel providers.
/// </summary>
public Dictionary<string, IProviderConfiguration> BroadcastChannel { get; } = [];
/// <summary>
/// Gets the stream providers.
/// </summary>
public Dictionary<string, IProviderConfiguration> Streaming { get; } = [];
/// <summary>
/// Gets or sets a value indicating whether to enable tracing of grain calls.
/// </summary>
/// <remarks>
/// Distributed tracing is enabled by default.
/// </remarks>
public bool? EnableDistributedTracing { get; set; }
}