private async ValueTask <PlacementResult> GetOrPlaceActivationAsync( ValueTask <PlacementResult> selectActivationTask, PlacementTarget target, PlacementStrategy strategy, IPlacementRuntime placementRuntime, IPlacementDirector director) { var placementResult = await selectActivationTask; if (placementResult is object) { return(placementResult); } var siloAddress = await director.OnAddActivation(strategy, target, placementRuntime); ActivationId activationId; if (strategy.IsDeterministicActivationId) { // Use the grain id as the activation id. activationId = ActivationId.GetDeterministic(target.GrainIdentity); } else { activationId = ActivationId.NewId(); } return(PlacementResult.SpecifyCreation( siloAddress, activationId, strategy)); }
private async ValueTask <PlacementResult> GetOrPlaceActivationAsync( PlacementTarget target, PlacementStrategy strategy, IPlacementRuntime placementRuntime, IActivationSelector selector, IPlacementDirector director) { var placementResult = await selector.OnSelectActivation(strategy, target.GrainIdentity, placementRuntime); if (placementResult is object) { return(placementResult); } var siloAddress = await director.OnAddActivation(strategy, target, placementRuntime); string grainTypeName; if (LegacyGrainId.TryConvertFromGrainId(target.GrainIdentity, out var legacyId)) { grainTypeName = placementRuntime.GetGrainTypeName(legacyId.TypeCode); } else { grainTypeName = null; } ActivationId activationId; if (strategy.IsDeterministicActivationId) { // Use the grain id as the activation id. activationId = ActivationId.GetDeterministic(target.GrainIdentity); } else { activationId = ActivationId.NewId(); } return(PlacementResult.SpecifyCreation( siloAddress, activationId, strategy, grainTypeName)); }