internal static async Task IsFaultServiceExisting(TimeSpan timeout, CancellationToken cancellationToken)
        {
            var applicationUri = UtilityHelper.GetApplicationUriFromServiceUri(FaulAnaylisServiceUri);
            var serviceList    = await InvokeWithRetryAsync(() =>
                                                            FabricClient.QueryManager.GetServiceListAsync(new Uri(applicationUri), new Uri(FaulAnaylisServiceUri), timeout, cancellationToken)
                                                            );

            if (serviceList.Count == 0)
            {
                throw new FabricException(StringResources.FaultAnalysisServiceNotEnabled,
                                          FabricErrorCode.FaultAnalysisServiceNotEnabled);
            }
        }
        internal static async Task <bool> ValidateServiceUri(string serviceUri, TimeSpan timeout, CancellationToken cancellationToken)
        {
            var applicationUri = UtilityHelper.GetApplicationUriFromServiceUri(serviceUri);
            var serviceList    = await InvokeWithRetryAsync(() =>
                                                            FabricClient.QueryManager.GetServiceListAsync(new Uri(UtilityHelper.GetUriFromCustomUri(applicationUri)), new Uri(UtilityHelper.GetUriFromCustomUri(serviceUri)), timeout, cancellationToken)
                                                            );

            if (serviceList.Count == 0)
            {
                throw new FabricException(StringResources.ServiceNotFound,
                                          FabricErrorCode.ServiceNotFound);
            }

            if (serviceList?[0] != null && serviceList[0].ServiceKind == ServiceKind.Stateful && ((StatefulService)serviceList[0]).HasPersistedState)
            {
                return(true);
            }

            throw new FabricException(StringResources.InvalidForStatelessServices, FabricErrorCode.InvalidForStatelessServices);
        }
        private async Task <bool> IsPartitionBackupSuspended(StatefulService statefulService, string processQueueTypeTrace)
        {
            var suspendStore = await SuspendStore.CreateOrGetSuspendStatusStore(statefulService);

            var fabricKey          = UtilityHelper.GetBackupMappingKey(this.ServiceUri, this.PartitionId);
            var containsSuspension = await suspendStore.GetValueAsync(fabricKey) ?? await suspendStore.GetValueAsync(ServiceUri) ?? await suspendStore.GetValueAsync(UtilityHelper.GetApplicationUriFromServiceUri(ServiceUri));

            BackupRestoreTrace.TraceSource.WriteInfo(processQueueTypeTrace, "IsPartition Suspended {0}", containsSuspension != null);
            return(containsSuspension != null);
        }