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 StreamChannelCoordinator(
            WrpStreamChannel streamChannel,
            IExceptionHandlingPolicy policy)
        {
            streamChannel.ThrowIfNull(nameof(streamChannel));
            policy.ThrowIfNull(nameof(policy));

            this.streamChannel   = streamChannel;
            this.exceptionPolicy = policy;
        }
Exemplo n.º 3
0
        public NodeStatusManager(
            KeyValueStoreReplica kvsStore,
            IConfigStore configStore,
            string configSectionName,
            IExceptionHandlingPolicy exceptionPolicy)
        {
            kvsStore.ThrowIfNull(nameof(kvsStore));
            configStore.ThrowIfNull(nameof(configStore));
            configSectionName.ThrowIfNullOrWhiteSpace(nameof(configSectionName));

            this.kvsStore          = kvsStore;
            this.configStore       = configStore;
            this.configSectionName = configSectionName;
            this.exceptionPolicy   = exceptionPolicy;
        }
Exemplo n.º 4
0
        internal ResourceCoordinator(
            KeyValueStoreReplica kvsStore,
            IConfigStore configStore,
            string configSectionName,
            IDictionary <ResourceType, IResourceCommandProcessor> resourceCommandProcessors,
            IWrpPackageRetriever packageRetriever,
            IExceptionHandlingPolicy healthPolicy)
        {
            kvsStore.ThrowIfNull(nameof(kvsStore));
            configStore.ThrowIfNull(nameof(configStore));
            configSectionName.ThrowIfNullOrWhiteSpace(nameof(configSectionName));
            resourceCommandProcessors.ThrowIfNull(nameof(resourceCommandProcessors));
            packageRetriever.ThrowIfNull(nameof(packageRetriever));
            healthPolicy.ThrowIfNull(nameof(healthPolicy));

            this.kvsStore          = kvsStore;
            this.configStore       = configStore;
            this.configSectionName = configSectionName;
            this.commandProcessors = resourceCommandProcessors;
            this.packageRetriever  = packageRetriever;
            this.exceptionPolicy   = healthPolicy;
        }
 public ExceptionHandlingFilter(IExceptionHandlingPolicy wrappedPolicy)
 {
     _wrappedPolicy = wrappedPolicy;
 }
Exemplo n.º 6
0
        internal static async Task <Transaction> CreateTransactionWithRetryAsync(this KeyValueStoreReplica kvsStore, IExceptionHandlingPolicy exceptionPolicy, CancellationToken token)
        {
            // TODO:
            // There's currently a bug in KVS where a service gets identified as a primary but doesn't actually have KVS write access.
            // Retrying solves the issue until the bug gets solved.
            while (!token.IsCancellationRequested)
            {
                try
                {
                    return(kvsStore.CreateTransaction());
                }
                catch (Exception e)
                {
                    exceptionPolicy.ReportError(e, false);

                    await Task.Delay(Constants.KvsCreateTransactionRetryTime, token);
                }
            }

            return(null);
        }