-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Silo Metadata and Placement Filtering #9271
Changes from 1 commit
7395b99
8aa83aa
d65153c
3ee780a
47899c1
9f4f60d
d715fdd
814a3ba
d969a85
9b44825
49e12bd
6aa01d5
27ddb5e
c6905be
0bc5ded
3c8a962
005d8c6
9aae9d0
ec8a407
ac45d1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#nullable enable | ||
|
||
namespace Orleans.Runtime.MembershipService.SiloMetadata; | ||
|
||
public interface ISiloMetadataCache | ||
{ | ||
SiloMetadata GetMetadata(SiloAddress siloAddress); | ||
SiloMetadata GetSiloMetadata(SiloAddress siloAddress); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
using System.Threading.Tasks; | ||
using Orleans.Services; | ||
|
||
#nullable enable | ||
namespace Orleans.Runtime.MembershipService.SiloMetadata; | ||
|
||
public interface ISiloMetadataClient : IGrainServiceClient<ISiloMetadataGrainService> | ||
internal interface ISiloMetadataClient | ||
{ | ||
Task<SiloMetadata> GetSiloMetadata(SiloAddress siloAddress); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Orleans.Runtime.Services; | ||
|
||
#nullable enable | ||
namespace Orleans.Runtime.MembershipService.SiloMetadata; | ||
|
||
public class SiloMetadataClient(IServiceProvider serviceProvider) | ||
: GrainServiceClient<ISiloMetadataGrainService>(serviceProvider), ISiloMetadataClient | ||
internal sealed class SiloMetadataClient(IInternalGrainFactory grainFactory) : ISiloMetadataClient | ||
{ | ||
public async Task<SiloMetadata> GetSiloMetadata(SiloAddress siloAddress) | ||
{ | ||
var grainService = GetGrainService(siloAddress); | ||
var metadata = await grainService.GetSiloMetadata(); | ||
var metadataSystemTarget = grainFactory.GetSystemTarget<ISiloMetadataSystemTarget>(Constants.SiloMetadataType, siloAddress); | ||
var metadata = await metadataSystemTarget.GetSiloMetadata(); | ||
return metadata; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
|
||
#nullable enable | ||
namespace Orleans.Runtime.MembershipService.SiloMetadata; | ||
|
||
public class SiloMetadataGrainService : GrainService, ISiloMetadataGrainService | ||
internal sealed class SiloMetadataSystemTarget( | ||
IOptions<SiloMetadata> siloMetadata, | ||
ILocalSiloDetails localSiloDetails, | ||
ILoggerFactory loggerFactory, | ||
IServiceProvider serviceProvider) | ||
: SystemTarget(Constants.SiloMetadataType, localSiloDetails.SiloAddress, loggerFactory), ISiloMetadataSystemTarget, ILifecycleParticipant<ISiloLifecycle> | ||
{ | ||
private readonly SiloMetadata _siloMetadata; | ||
private readonly SiloMetadata _siloMetadata = siloMetadata.Value; | ||
|
||
public SiloMetadataGrainService(IOptions<SiloMetadata> siloMetadata) : base() | ||
{ | ||
_siloMetadata = siloMetadata.Value; | ||
} | ||
public Task<SiloMetadata> GetSiloMetadata() => Task.FromResult(_siloMetadata); | ||
|
||
public SiloMetadataGrainService(IOptions<SiloMetadata> siloMetadata, GrainId grainId, Silo silo, ILoggerFactory loggerFactory) : base(grainId, silo, loggerFactory) | ||
void ILifecycleParticipant<ISiloLifecycle>.Participate(ISiloLifecycle lifecycle) | ||
{ | ||
_siloMetadata = siloMetadata.Value; | ||
} | ||
lifecycle.Subscribe(nameof(SiloMetadataSystemTarget), ServiceLifecycleStage.RuntimeInitialize, OnRuntimeInitializeStart, OnRuntimeInitializeStop); | ||
|
||
public Task<SiloMetadata> GetSiloMetadata() => Task.FromResult(_siloMetadata); | ||
Task OnRuntimeInitializeStart(CancellationToken token) | ||
{ | ||
serviceProvider.GetRequiredService<Catalog>().RegisterSystemTarget(this); | ||
return Task.CompletedTask; | ||
} | ||
|
||
Task OnRuntimeInitializeStop(CancellationToken token) => Task.CompletedTask; | ||
} | ||
} |
Unchanged files with check annotations Beta
{ | ||
var multiRunner = new MultipleStreamsTestRunner(fixture.Cluster.InternalClient, SingleStreamTestRunner.AQ_STREAM_PROVIDER_NAME, 17, false); | ||
await multiRunner.StreamTest_MultipleStreams_ManyDifferent_ManyProducerGrainsManyConsumerGrains( | ||
fixture.Cluster.StartAdditionalSilo); | ||
Check failure on line 247 in test/Extensions/TesterAzureUtils/Streaming/AQStreamingTests.cs
|
||
} | ||
//[SkippableFact, TestCategory("BVT")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This previous code was copied from DistributedGrainDirectory. Should there be a follow up issue to update usages of the prior pattern with this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should clean up the other instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #9360