当前位置: 首页>>代码示例>>C#>>正文


C# IBrightstarService.ConsolidateStore方法代码示例

本文整理汇总了C#中IBrightstarService.ConsolidateStore方法的典型用法代码示例。如果您正苦于以下问题:C# IBrightstarService.ConsolidateStore方法的具体用法?C# IBrightstarService.ConsolidateStore怎么用?C# IBrightstarService.ConsolidateStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IBrightstarService的用法示例。


在下文中一共展示了IBrightstarService.ConsolidateStore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunCompressJob

 static bool RunCompressJob(IBrightstarService client, string storeName, out string finalMessage)
 {
     var compressJob = client.ConsolidateStore(storeName);
     while (!(compressJob.JobCompletedOk || compressJob.JobCompletedWithErrors))
     {
         System.Threading.Thread.Sleep(1000);
         compressJob = client.GetJobInfo(storeName, compressJob.JobId);
     }
     finalMessage = compressJob.StatusMessage;
     if (compressJob.ExceptionInfo != null)
     {
         finalMessage += " Exception Detail:" + compressJob.ExceptionInfo;
     }
     return compressJob.JobCompletedOk;
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:15,代码来源:Compress.cs

示例2: JobsModule

        public JobsModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider permissionsProvider)
        {
            this.RequiresBrightstarStorePermissionData(permissionsProvider);

            Get["/{storeName}/jobs"] = parameters =>
                {
                    var jobsRequestObject = this.Bind<JobsRequestModel>();
                    ViewBag.Title = jobsRequestObject.StoreName + " - Jobs";
                    if (jobsRequestObject == null || jobsRequestObject.StoreName == null)
                    {
                        return HttpStatusCode.BadRequest;
                    }
                    if (jobsRequestObject.Take <= 0) jobsRequestObject.Take = DefaultPageSize;
                    var jobs = brightstarService.GetJobInfo(jobsRequestObject.StoreName, jobsRequestObject.Skip,
                                                            jobsRequestObject.Take + 1);
                    return Negotiate.WithPagedList(jobsRequestObject,
                                                   jobs.Select(j=>j.MakeResponseObject(jobsRequestObject.StoreName)),
                                                   jobsRequestObject.Skip, jobsRequestObject.Take, DefaultPageSize,
                                                   "jobs");
                };

            Get["/{storeName}/jobs/{jobId}"] = parameters =>
                {
                    var request = this.Bind<JobRequestModel>();
                    if (request == null ||
                        request.StoreName == null ||
                        request.JobId == null)
                    {
                        return HttpStatusCode.BadRequest;
                    }
                    ViewBag.Title = request.StoreName + " - Job - " + request.JobId;
                    var job = brightstarService.GetJobInfo(request.StoreName, request.JobId);
                    if (job == null) return HttpStatusCode.NotFound;
                    var responseDto = job.MakeResponseObject(request.StoreName);
                    return responseDto;
                };

            Post["/{storeName}/jobs"] = parameters =>
                {
                    var jobRequestObject = this.Bind<JobRequestObject>();
                    ViewBag.Title = jobRequestObject.StoreName + "- Jobs";
                    // Validate
                    if (jobRequestObject == null) return HttpStatusCode.BadRequest;
                    if (String.IsNullOrWhiteSpace(jobRequestObject.JobType)) return HttpStatusCode.BadRequest;

                    var storeName = parameters["storeName"];
                    var label = jobRequestObject.Label;
                    try
                    {
                        IJobInfo queuedJobInfo;
                        switch (jobRequestObject.JobType.ToLowerInvariant())
                        {
                            case "consolidate":
                                AssertPermission(StorePermissions.Admin);
                                queuedJobInfo = brightstarService.ConsolidateStore(storeName, label);
                                break;

                            case "createsnapshot":
                                AssertPermission(StorePermissions.Admin);
                                PersistenceType persistenceType;

                                // Validate TargetStoreName and PersistenceType parameters
                                if (!jobRequestObject.JobParameters.ContainsKey("TargetStoreName") ||
                                    String.IsNullOrWhiteSpace(jobRequestObject.JobParameters["TargetStoreName"]) ||
                                    !jobRequestObject.JobParameters.ContainsKey("PersistenceType") ||
                                    !Enum.TryParse(jobRequestObject.JobParameters["PersistenceType"],
                                                   out persistenceType))
                                {
                                    return HttpStatusCode.BadRequest;
                                }
                                // Extract optional commit point parameter
                                ICommitPointInfo commitPoint = null;
                                if (jobRequestObject.JobParameters.ContainsKey("CommitId"))
                                {
                                    ulong commitId;
                                    if (!UInt64.TryParse(jobRequestObject.JobParameters["CommitId"], out commitId))
                                    {
                                        return HttpStatusCode.BadRequest;
                                    }
                                    commitPoint = brightstarService.GetCommitPoint(storeName, commitId);
                                    if (commitPoint == null)
                                    {
                                        return HttpStatusCode.BadRequest;
                                    }
                                }

                                // Execute
                                queuedJobInfo = brightstarService.CreateSnapshot(
                                    storeName, jobRequestObject.JobParameters["TargetStoreName"],
                                    persistenceType, commitPoint, label);
                                break;

                            case "export":
                                AssertPermission(StorePermissions.Export);
                                if (!jobRequestObject.JobParameters.ContainsKey("FileName") ||
                                    String.IsNullOrWhiteSpace(jobRequestObject.JobParameters["FileName"]))
                                {
                                    return HttpStatusCode.BadRequest;
                                }
                                RdfFormat format = jobRequestObject.JobParameters.ContainsKey("Format")
//.........这里部分代码省略.........
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:101,代码来源:JobsModule.cs


注:本文中的IBrightstarService.ConsolidateStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。