[6983] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[11170] | 3 | * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[6983] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Linq.Expressions;
|
---|
| 25 | using HeuristicLab.Services.Hive.DataAccess;
|
---|
| 26 | using DT = HeuristicLab.Services.Hive.DataTransfer;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Services.Hive {
|
---|
| 29 | public interface IHiveDao {
|
---|
| 30 | #region Task Methods
|
---|
| 31 | DT.Task GetTask(Guid id);
|
---|
| 32 | IEnumerable<DT.Task> GetTasks(Expression<Func<Task, bool>> predicate);
|
---|
[9022] | 33 | IEnumerable<DT.LightweightTask> GetLightweightTasks(Expression<Func<Task, bool>> predicate);
|
---|
[9219] | 34 | IEnumerable<DT.LightweightTask> GetLightweightTasksWithoutStateLog(Expression<Func<Task, bool>> predicate);
|
---|
[6983] | 35 | Guid AddTask(DT.Task dto);
|
---|
[9123] | 36 | void UpdateTaskAndPlugins(DT.Task dto);
|
---|
[9266] | 37 | void UpdateTaskAndStateLogs(DT.Task dto);
|
---|
[6983] | 38 | void UpdateTask(DT.Task dto);
|
---|
| 39 | void DeleteTask(Guid id);
|
---|
[9123] | 40 | IEnumerable<TaskInfoForScheduler> GetWaitingTasks(DT.Slave slave);
|
---|
[6983] | 41 | IEnumerable<DT.Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished);
|
---|
| 42 | DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
| 43 | #endregion
|
---|
| 44 |
|
---|
| 45 | #region TaskData Methods
|
---|
| 46 | DT.TaskData GetTaskData(Guid id);
|
---|
| 47 | IEnumerable<DT.TaskData> GetTaskDatas(Expression<Func<TaskData, bool>> predicate);
|
---|
| 48 | Guid AddTaskData(DT.TaskData dto);
|
---|
| 49 | void UpdateTaskData(DT.TaskData dto);
|
---|
| 50 | void DeleteTaskData(Guid id);
|
---|
| 51 | #endregion
|
---|
| 52 |
|
---|
| 53 | #region StateLog Methods
|
---|
| 54 | DT.StateLog GetStateLog(Guid id);
|
---|
| 55 | IEnumerable<DT.StateLog> GetStateLogs(Expression<Func<StateLog, bool>> predicate);
|
---|
| 56 | Guid AddStateLog(DT.StateLog dto);
|
---|
| 57 | void UpdateStateLog(DT.StateLog dto);
|
---|
| 58 | void DeleteStateLog(Guid id);
|
---|
| 59 | #endregion
|
---|
| 60 |
|
---|
| 61 | #region Job Methods
|
---|
| 62 | DT.Job GetJob(Guid id);
|
---|
| 63 | IEnumerable<DT.Job> GetJobs(Expression<Func<Job, bool>> predicate);
|
---|
[9123] | 64 | IEnumerable<JobInfoForScheduler> GetJobInfoForScheduler(Expression<Func<Job, bool>> predicate);
|
---|
[6983] | 65 | Guid AddJob(DT.Job dto);
|
---|
| 66 | void UpdateJob(DT.Job dto);
|
---|
| 67 | void DeleteJob(Guid id);
|
---|
| 68 | #endregion
|
---|
| 69 |
|
---|
| 70 | #region JobPermission Methods
|
---|
| 71 | DT.JobPermission GetJobPermission(Guid jobId, Guid grantedUserId);
|
---|
| 72 | IEnumerable<DT.JobPermission> GetJobPermissions(Expression<Func<JobPermission, bool>> predicate);
|
---|
| 73 | void AddJobPermission(DT.JobPermission dto);
|
---|
| 74 | void UpdateJobPermission(DT.JobPermission dto);
|
---|
| 75 | void DeleteJobPermission(Guid jobId, Guid grantedUserId);
|
---|
| 76 | void SetJobPermission(Guid jobId, Guid grantedByUserId, Guid grantedUserId, Permission permission);
|
---|
| 77 | #endregion
|
---|
| 78 |
|
---|
| 79 | #region Plugin Methods
|
---|
| 80 | DT.Plugin GetPlugin(Guid id);
|
---|
| 81 | IEnumerable<DT.Plugin> GetPlugins(Expression<Func<Plugin, bool>> predicate);
|
---|
| 82 | Guid AddPlugin(DT.Plugin dto);
|
---|
| 83 | void UpdatePlugin(DT.Plugin dto);
|
---|
| 84 | void DeletePlugin(Guid id);
|
---|
| 85 | #endregion
|
---|
| 86 |
|
---|
| 87 | #region PluginData Methods
|
---|
| 88 | DT.PluginData GetPluginData(Guid id);
|
---|
| 89 | IEnumerable<DT.PluginData> GetPluginDatas(Expression<Func<PluginData, bool>> predicate);
|
---|
| 90 | Guid AddPluginData(DT.PluginData dto);
|
---|
| 91 | void UpdatePluginData(DT.PluginData dto);
|
---|
| 92 | void DeletePluginData(Guid id);
|
---|
| 93 | #endregion
|
---|
| 94 |
|
---|
| 95 | #region Slave Methods
|
---|
| 96 | DT.Slave GetSlave(Guid id);
|
---|
| 97 | IEnumerable<DT.Slave> GetSlaves(Expression<Func<Slave, bool>> predicate);
|
---|
| 98 | Guid AddSlave(DT.Slave dto);
|
---|
| 99 | void UpdateSlave(DT.Slave dto);
|
---|
| 100 | void DeleteSlave(Guid id);
|
---|
| 101 | #endregion
|
---|
| 102 |
|
---|
| 103 | #region SlaveGroup Methods
|
---|
| 104 | DT.SlaveGroup GetSlaveGroup(Guid id);
|
---|
| 105 | IEnumerable<DT.SlaveGroup> GetSlaveGroups(Expression<Func<SlaveGroup, bool>> predicate);
|
---|
| 106 | Guid AddSlaveGroup(DT.SlaveGroup dto);
|
---|
| 107 | void UpdateSlaveGroup(DT.SlaveGroup dto);
|
---|
| 108 | void DeleteSlaveGroup(Guid id);
|
---|
| 109 | #endregion
|
---|
| 110 |
|
---|
| 111 | #region Resource Methods
|
---|
| 112 | DT.Resource GetResource(Guid id);
|
---|
| 113 | IEnumerable<DT.Resource> GetResources(Expression<Func<Resource, bool>> predicate);
|
---|
| 114 | Guid AddResource(DT.Resource dto);
|
---|
| 115 | void UpdateResource(DT.Resource dto);
|
---|
| 116 | void DeleteResource(Guid id);
|
---|
[9257] | 117 | void AssignJobToResource(Guid taskId, IEnumerable<Guid> resourceIds);
|
---|
[6983] | 118 | IEnumerable<DT.Resource> GetAssignedResources(Guid jobId);
|
---|
| 119 | IEnumerable<DT.Resource> GetParentResources(Guid resourceId);
|
---|
| 120 | IEnumerable<DT.Resource> GetChildResources(Guid resourceId);
|
---|
| 121 | IEnumerable<DT.Task> GetJobsByResourceId(Guid resourceId);
|
---|
| 122 | #endregion
|
---|
| 123 |
|
---|
[7916] | 124 | #region ResourcePermission Methods
|
---|
| 125 | DT.ResourcePermission GetResourcePermission(Guid resourceId, Guid grantedUserId);
|
---|
| 126 | IEnumerable<DT.ResourcePermission> GetResourcePermissions(Expression<Func<ResourcePermission, bool>> predicate);
|
---|
| 127 | void AddResourcePermission(DT.ResourcePermission dto);
|
---|
| 128 | void UpdateResourcePermission(DT.ResourcePermission dto);
|
---|
| 129 | void DeleteResourcePermission(Guid resourceId, Guid grantedUserId);
|
---|
| 130 | #endregion
|
---|
| 131 |
|
---|
[6983] | 132 | #region Authorization Methods
|
---|
| 133 | Permission GetPermissionForTask(Guid taskId, Guid userId);
|
---|
| 134 | Permission GetPermissionForJob(Guid jobId, Guid userId);
|
---|
| 135 | Guid GetJobForTask(Guid taskId);
|
---|
| 136 | #endregion
|
---|
| 137 |
|
---|
| 138 | #region Lifecycle Methods
|
---|
| 139 | DateTime GetLastCleanup();
|
---|
| 140 | void SetLastCleanup(DateTime datetime);
|
---|
| 141 | #endregion
|
---|
| 142 |
|
---|
| 143 | #region Downtime Methods
|
---|
| 144 | DT.Downtime GetDowntime(Guid id);
|
---|
| 145 | IEnumerable<DT.Downtime> GetDowntimes(Expression<Func<Downtime, bool>> predicate);
|
---|
| 146 | Guid AddDowntime(DT.Downtime dto);
|
---|
| 147 | void UpdateDowntime(DT.Downtime dto);
|
---|
| 148 | void DeleteDowntime(Guid id);
|
---|
| 149 | #endregion
|
---|
| 150 |
|
---|
| 151 | #region Statistics Methods
|
---|
[9022] | 152 | Dictionary<Guid, int> GetWaitingTasksByUser();
|
---|
[9033] | 153 | Dictionary<Guid, int> GetWaitingTasksByUserForResources(List<Guid> resourceIds);
|
---|
[9022] | 154 | Dictionary<Guid, int> GetCalculatingTasksByUser();
|
---|
[9033] | 155 | Dictionary<Guid, int> GetCalculatingTasksByUserForResources(List<Guid> resourceIds);
|
---|
[6983] | 156 | DT.Statistics GetStatistic(Guid id);
|
---|
| 157 | IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate);
|
---|
| 158 | Guid AddStatistics(DT.Statistics dto);
|
---|
| 159 | void DeleteStatistics(Guid id);
|
---|
| 160 | List<DT.UserStatistics> GetUserStatistics();
|
---|
| 161 | #endregion
|
---|
[9123] | 162 |
|
---|
| 163 | #region UserPriority Methods
|
---|
| 164 | IEnumerable<DT.UserPriority> GetUserPriorities(Expression<Func<UserPriority, bool>> predicate);
|
---|
| 165 | void EnqueueUserPriority(DT.UserPriority userPriority);
|
---|
| 166 | #endregion
|
---|
[6983] | 167 | }
|
---|
| 168 | }
|
---|