public IEnumerable <T> FindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) where T : IConfigurable, new() { using (HostRpcClient client = new HostRpcClient(this.serverFqdn)) { foreach (TaskStoreObject task in client.GetDarTask(this.darParams)) { yield return((T)((object)task)); } } yield break; }
protected override void InternalProcessRecord() { base.WriteObject("Sending no op task"); OrganizationId organizationId = (this.TenantId != null) ? GetDarTask.ResolveOrganizationId(this.TenantId) : OrganizationId.ForestWideOrgId; string fqdn = GetDarTask.ResolveServerId(base.CurrentOrganizationId).Fqdn; using (HostRpcClient hostRpcClient = new HostRpcClient(fqdn)) { string text = Guid.NewGuid().ToString(); TaskStoreObject darTask = new TaskStoreObject { Id = text, TaskType = "Common.NoOp", TenantId = organizationId.GetBytes(Encoding.UTF8) }; hostRpcClient.SetDarTask(darTask); base.WriteObject("Task enqueued, waiting for completed status. ID:" + text); for (int i = 0; i < this.Retries; i++) { TaskStoreObject[] darTask2 = hostRpcClient.GetDarTask(new DarTaskParams { TaskId = text }); if (darTask2.Length > 1) { base.WriteError(new Exception("Unexected number of tasks returned by GetDarTask"), ErrorCategory.InvalidResult, darTask2.Length); return; } if (darTask2.Length == 1) { base.WriteObject("Task state: " + darTask2[0].TaskState); if (darTask2[0].TaskState == DarTaskState.Completed) { return; } } else { base.WriteObject("No tasks found"); } Thread.Sleep(1000); } } base.WriteError(new Exception("Operation timeout"), ErrorCategory.OperationTimeout, null); }
public IConfigurable Read <T>(ObjectId identity) where T : IConfigurable, new() { if (identity == null) { throw new ArgumentNullException("identity"); } using (HostRpcClient hostRpcClient = new HostRpcClient(this.serverFqdn)) { DarTaskParams darTaskParams = new DarTaskParams { TaskId = this.darParams.TaskId, TenantId = this.darParams.TenantId }; TaskStoreObject[] darTask = hostRpcClient.GetDarTask(darTaskParams); int num = 0; if (num < darTask.Length) { TaskStoreObject taskStoreObject = darTask[num]; return((T)((object)taskStoreObject)); } } return(null); }