internal FabricUpgradeOrchestrationService(StatefulServiceContext serviceContext, string endpoint, bool enableEndpointV2)
            : base(
                serviceContext,
                new ReliableStateManager(
                    serviceContext,
                    new ReliableStateManagerConfiguration(
                        GetReplicatorSettings(endpoint, enableEndpointV2))))
        {
            this.endpoint         = endpoint;
            this.enableEndpointV2 = enableEndpointV2;
            this.fabricClient     = new FabricClient();
            this.storeManager     = new StoreManager(this.StateManager);
            this.Orchestrator     = new UpgradeOrchestrator(this.storeManager, this, this.fabricClient);

            this.messageProcessor = new UpgradeOrchestrationMessageProcessor(
                this.storeManager,
                this.fabricClient,
                this.Orchestrator,
                new CancellationToken(canceled: false));

            UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "FabricUpgradeOrchestrationService constructor: enableEndpointV2 is {0}", this.enableEndpointV2);

            if (this.enableEndpointV2)
            {
                this.clusterEndpointSecuritySettingsChangeNotifier = new ClusterEndpointSecuritySettingsChangeNotifier(this.endpoint, this.UpdateReplicatorSettings);
            }

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnResolveAssemblyFailed);
        }
 /// <summary>
 /// An instance of this class is created for each service replica by the Service Fabric runtime.
 /// </summary>
 internal BackupRestoreService(StatefulServiceContext serviceContext, string endpoint)
     : base(
         serviceContext,
         new ReliableStateManager(
             serviceContext,
             new ReliableStateManagerConfiguration(
                 GetReplicatorSettings(endpoint))))
 {
     this.clusterEndpointSecuritySettingsChangeNotifier = new ClusterEndpointSecuritySettingsChangeNotifier(endpoint, this.UpdateReplicatorSettings);
 }
        internal FaultAnalysisService(StatefulServiceContext serviceContext, string endpoint, bool enableEndpointV2)
            : base(
                serviceContext,
                new ReliableStateManager(
                    serviceContext,
                    new ReliableStateManagerConfiguration(
                        GetReplicatorSettings(endpoint, enableEndpointV2))))
        {
            this.endpoint         = endpoint;
            this.enableEndpointV2 = enableEndpointV2;

            if (this.enableEndpointV2)
            {
                this.clusterEndpointSecuritySettingsChangeNotifier = new ClusterEndpointSecuritySettingsChangeNotifier(endpoint, this.UpdateReplicatorSettings);
            }

            this.scheduler = new ChaosScheduler(this.StateManager, this.Partition);
        }
Esempio n. 4
0
        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);
            }
        }
        private UpgradeSystemService(
            string workingDirectory,
            Guid partitionId)
            : base(
                workingDirectory,     // (V2 only)
                DatabaseSubDirectory, // (V2 only)
                DatabaseFileName,     // (both V1 and V2)
                partitionId)          // shared log ID (V2 only)
        {
            this.cancellationTokenSource = null;

            this.configStore      = NativeConfigStore.FabricGetConfigStore();
            this.enableEndpointV2 = EnableEndpointV2Utility.GetValue(configStore);

            this.replicatorAddress = GetReplicatorAddress();
            Trace.WriteInfo(TraceType, "Read UpgradeServiceReplicatorAddress={0}", this.replicatorAddress);

            if (this.enableEndpointV2)
            {
                this.clusterEndpointSecuritySettingsChangeNotifier = new ClusterEndpointSecuritySettingsChangeNotifier(
                    this.replicatorAddress,
                    this.UpdateReplicatorSettingsOnConfigChange);
            }
        }