public AzureParallelInfrastructureCoordinatorFactory( Uri serviceName, IConfigStore configStore, string configSectionName, Guid partitionId, long replicaId, IInfrastructureAgentWrapper agent) { this.serviceName = serviceName.Validate("serviceName"); configStore.Validate("configStore"); configSectionName.Validate("configSectionName"); this.agent = agent.Validate("agent"); this.configSection = new ConfigSection(TraceType, configStore, configSectionName); this.partitionId = partitionId; this.replicaId = replicaId; try { this.tenantId = AzureHelper.GetTenantId(configSection); } catch (Exception ex) { // this happens on the Linux environment (since there is no registry) this.tenantId = PartitionIdPrefix + partitionId; TraceType.WriteWarning("Unable to get tenant Id from configuration. Using partition Id '{0}' text instead. Exception: {1}", this.tenantId, ex); } // TODO use tenant ID or config section name suffix as base trace ID? this.env = new CoordinatorEnvironment(this.serviceName.AbsoluteUri, this.configSection, tenantId, this.agent); this.activityLogger = new ActivityLoggerFactory().Create(env.CreateTraceType("Event")); this.policyAgentServiceWrapper = new PolicyAgentServiceWrapper(env, activityLogger); }
/// <remarks> /// If <see cref="configSettings"/> is null, a default value is used. /// </remarks> public MockInfrastructureCoordinatorFactory(IManagementClient managementClient, IDictionary <string, string> configSettings = null, IQueryClient queryClient = null, IInfrastructureAgentWrapper agent = null) { managementClient.ThrowIfNull("managementClient"); this.managementClient = managementClient; this.configSettings = configSettings != null ? new Dictionary <string, string>(configSettings, StringComparer.OrdinalIgnoreCase) : new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); this.queryClient = queryClient ?? new MockQueryClient(); this.agent = agent ?? new MockInfrastructureAgentWrapper(); }
public WindowsAzureInfrastructureCoordinatorFactory( IConfigStore configStore, string configSectionName, Guid partitionId, long replicaId, IInfrastructureAgentWrapper agent, IAzureModeDetector modeDetector) { configStore.ThrowIfNull("configStore"); configSectionName.ThrowIfNullOrWhiteSpace("configSectionName"); agent.ThrowIfNull("agent"); this.configStore = configStore; this.configSectionName = configSectionName; this.agent = agent; this.partitionId = partitionId; this.replicaId = replicaId; this.modeDetector = modeDetector; }
private ServiceFactory( IInfrastructureAgentWrapper infrastructureServiceAgent, IConfigStore configStore, string configSectionName, FactoryConfigUpdateHandler configUpdateHandler) { this.infrastructureServiceAgent = infrastructureServiceAgent; this.configStore = configStore.Validate("configStore"); this.configSectionName = configSectionName; this.configUpdateHandler = configUpdateHandler; this.coordinatorFactoryMap.Add("Disabled", this.CreateCoordinatorNull); this.coordinatorFactoryMap.Add("Test", this.CreateCoordinatorTest); this.coordinatorFactoryMap.Add("ServerRestart", this.CreateCoordinatorServerRestart); this.coordinatorFactoryMap.Add("AzureSerial", this.CreateCoordinatorAzureSerial); this.coordinatorFactoryMap.Add("AzureParallel", this.CreateCoordinatorAzureParallel); this.coordinatorFactoryMap.Add("AzureParallelDisabled", this.CreateCoordinatorAzureParallelDisabled); this.coordinatorFactoryMap.Add("AzureAutodetect", this.CreateCoordinatorAzureAutodetect); this.coordinatorFactoryMap.Add("Dynamic", this.CreateCoordinatorDynamic); }
internal ServiceReplica( IInfrastructureAgentWrapper infrastructureServiceAgent, IInfrastructureCoordinator coordinator, string replicatorAddress, bool useClusterSecuritySettingsForReplicator, IConfigSection configSection) { if (infrastructureServiceAgent == null) { throw new ArgumentNullException("infrastructureServiceAgent"); } if (coordinator == null) { throw new ArgumentNullException("coordinator"); } if (configSection == null) { throw new ArgumentNullException("configSection"); } this.infrastructureServiceAgent = infrastructureServiceAgent; this.coordinator = coordinator; this.replicatorAddress = replicatorAddress; this.useClusterSecuritySettingsForReplicator = useClusterSecuritySettingsForReplicator; this.configSection = configSection; this.replicaRoleLock = new object(); this.replicaRole = ReplicaRole.Unknown; TraceType.WriteInfo("Created replica: coordinator = {0}, replicator address = {1}, useClusterSecuritySettingsForReplicator = {2}", this.coordinator.GetType().FullName, this.replicatorAddress ?? "<null>", this.useClusterSecuritySettingsForReplicator); if (this.useClusterSecuritySettingsForReplicator) { this.clusterEndpointSecuritySettingsChangeNotifier = new ClusterEndpointSecuritySettingsChangeNotifier(this.replicatorAddress, this.UpdateReplicatorSettings); } }
public TestInfrastructureCoordinator(IInfrastructureAgentWrapper infrastructureServiceAgent, Guid partitionId) { this.commandProcessor = new CommandProcessor(infrastructureServiceAgent); this.partitionId = partitionId; }
public CommandProcessor(IInfrastructureAgentWrapper infrastructureServiceAgent) { this.infrastructureServiceAgent = infrastructureServiceAgent; this.pendingStartCommands = new PendingCommandContextMap(); this.pendingFinishCommands = new PendingCommandContextMap(); }
public CoordinatorEnvironment(string serviceName, IConfigSection configSection, string baseTraceId, IInfrastructureAgentWrapper infrastructureAgent) { this.ServiceName = serviceName.Validate("serviceName"); this.Config = configSection.Validate("configSection"); this.DefaultTraceType = new TraceType(Constants.TraceTypeName, baseTraceId); this.InfrastructureAgent = infrastructureAgent; // allow null for test/tools }