public WindowsUpdateServiceCoordinator(IConfigStore configStore, string configSection, KeyValueStoreReplica kvsReplica, IStatefulServicePartition partition, IExceptionHandlingPolicy exceptionPolicy)
        {
            configStore.ThrowIfNull("configStore");
            configSection.ThrowIfNullOrWhiteSpace("configSectionName");
            kvsReplica.ThrowIfNull("kvsReplica");
            partition.ThrowIfNull("partition");
            exceptionPolicy.ThrowIfNull("exceptionPolicy");

            this.commandProcessor  = new FabricClientWrapper();
            this.store             = kvsReplica;
            this.partition         = partition;
            this.packageRetriever  = new UpdatePackageRetriever();
            this.serviceName       = new Uri(Constants.SystemServicePrefix + configSection);
            this.configStore       = configStore;
            this.configSectionName = configSection;
            this.exceptionPolicy   = exceptionPolicy;

            // Read all the configuration values
            string coordinatorType = configStore.ReadUnencryptedString(configSection, Constants.ConfigurationSection.CoordinatorType);

            this.testMode   = false;
            this.testSrcDir = string.Empty;
            if (coordinatorType.Equals(Constants.ConfigurationSection.WUTestCoordinator))
            {
                this.testSrcDir = configStore.ReadUnencryptedString(configSection, Constants.WUSCoordinator.TestCabFolderParam);
                this.testMode   = true;
            }

            this.waitTimeBeforePolling   = TimeSpan.FromMinutes(Constants.WUSCoordinator.PollingIntervalInMinutesDefault);
            this.windowsUpdateApiTimeout = TimeSpan.FromMinutes(Constants.WUSCoordinator.WuApiTimeoutInMinutesDefault);
        }
        public PaasCoordinator(
            IConfigStore configStore,
            string configSectionName,
            KeyValueStoreReplica kvsStore,
            IStatefulServicePartition partition)
        {
            configStore.ThrowIfNull("configStore");
            configSectionName.ThrowIfNullOrWhiteSpace("configSectionName");
            partition.ThrowIfNull("partition");

            this.Initialize(configStore, configSectionName, kvsStore, partition);
        }
        protected override Task OnOpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken)
        {
            partition.ThrowIfNull("partition");
            this.partition = partition;

            Trace.WriteInfo(
                TraceType,
                "OpenAsync: serviceId = {0}, configSectionName = {1}, OpenMode = {2}",
                this.serviceId,
                this.configSectionName,
                openMode);

            return(base.OnOpenAsync(openMode, partition, cancellationToken));
        }
Example #4
0
        internal ExceptionHandlingPolicy(
            string healthProperty,
            string taskName,
            IConfigStore configStore,
            string configSectionName,
            IStatefulServicePartition partition)
        {
            healthProperty.ThrowIfNullOrWhiteSpace(nameof(healthProperty));
            taskName.ThrowIfNullOrWhiteSpace(nameof(taskName));
            configStore.ThrowIfNull(nameof(configStore));
            configSectionName.ThrowIfNullOrWhiteSpace(nameof(configSectionName));
            partition.ThrowIfNull(nameof(partition));

            this.configStore       = configStore;
            this.configSectionName = configSectionName;
            this.partition         = partition;
            this.HealthProperty    = healthProperty;
            this.TaskName          = taskName;

            this.ContinuousFailureCount = 0;
            this.TraceType = new TraceType(healthProperty);
        }