本文整理汇总了C#中IBrightstarService.CreateSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C# IBrightstarService.CreateSnapshot方法的具体用法?C# IBrightstarService.CreateSnapshot怎么用?C# IBrightstarService.CreateSnapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBrightstarService
的用法示例。
在下文中一共展示了IBrightstarService.CreateSnapshot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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")
//.........这里部分代码省略.........