1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
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);
|
---|
33 | IEnumerable<DT.LightweightTask> GetLightweightTasks(Expression<Func<Task, bool>> predicate);
|
---|
34 | Guid AddTask(DT.Task dto);
|
---|
35 | void UpdateTaskAndPlugins(DT.Task dto);
|
---|
36 | void UpdateTask(DT.Task dto);
|
---|
37 | void DeleteTask(Guid id);
|
---|
38 | IEnumerable<TaskInfoForScheduler> GetWaitingTasks(DT.Slave slave);
|
---|
39 | IEnumerable<DT.Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished);
|
---|
40 | DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
41 | #endregion
|
---|
42 |
|
---|
43 | #region TaskData Methods
|
---|
44 | DT.TaskData GetTaskData(Guid id);
|
---|
45 | IEnumerable<DT.TaskData> GetTaskDatas(Expression<Func<TaskData, bool>> predicate);
|
---|
46 | Guid AddTaskData(DT.TaskData dto);
|
---|
47 | void UpdateTaskData(DT.TaskData dto);
|
---|
48 | void DeleteTaskData(Guid id);
|
---|
49 | #endregion
|
---|
50 |
|
---|
51 | #region StateLog Methods
|
---|
52 | DT.StateLog GetStateLog(Guid id);
|
---|
53 | IEnumerable<DT.StateLog> GetStateLogs(Expression<Func<StateLog, bool>> predicate);
|
---|
54 | Guid AddStateLog(DT.StateLog dto);
|
---|
55 | void UpdateStateLog(DT.StateLog dto);
|
---|
56 | void DeleteStateLog(Guid id);
|
---|
57 | #endregion
|
---|
58 |
|
---|
59 | #region Job Methods
|
---|
60 | DT.Job GetJob(Guid id);
|
---|
61 | IEnumerable<DT.Job> GetJobs(Expression<Func<Job, bool>> predicate);
|
---|
62 | IEnumerable<JobInfoForScheduler> GetJobInfoForScheduler(Expression<Func<Job, bool>> predicate);
|
---|
63 | Guid AddJob(DT.Job dto);
|
---|
64 | void UpdateJob(DT.Job dto);
|
---|
65 | void DeleteJob(Guid id);
|
---|
66 | #endregion
|
---|
67 |
|
---|
68 | #region JobPermission Methods
|
---|
69 | DT.JobPermission GetJobPermission(Guid jobId, Guid grantedUserId);
|
---|
70 | IEnumerable<DT.JobPermission> GetJobPermissions(Expression<Func<JobPermission, bool>> predicate);
|
---|
71 | void AddJobPermission(DT.JobPermission dto);
|
---|
72 | void UpdateJobPermission(DT.JobPermission dto);
|
---|
73 | void DeleteJobPermission(Guid jobId, Guid grantedUserId);
|
---|
74 | void SetJobPermission(Guid jobId, Guid grantedByUserId, Guid grantedUserId, Permission permission);
|
---|
75 | #endregion
|
---|
76 |
|
---|
77 | #region Plugin Methods
|
---|
78 | DT.Plugin GetPlugin(Guid id);
|
---|
79 | IEnumerable<DT.Plugin> GetPlugins(Expression<Func<Plugin, bool>> predicate);
|
---|
80 | Guid AddPlugin(DT.Plugin dto);
|
---|
81 | void UpdatePlugin(DT.Plugin dto);
|
---|
82 | void DeletePlugin(Guid id);
|
---|
83 | #endregion
|
---|
84 |
|
---|
85 | #region PluginData Methods
|
---|
86 | DT.PluginData GetPluginData(Guid id);
|
---|
87 | IEnumerable<DT.PluginData> GetPluginDatas(Expression<Func<PluginData, bool>> predicate);
|
---|
88 | Guid AddPluginData(DT.PluginData dto);
|
---|
89 | void UpdatePluginData(DT.PluginData dto);
|
---|
90 | void DeletePluginData(Guid id);
|
---|
91 | #endregion
|
---|
92 |
|
---|
93 | #region Slave Methods
|
---|
94 | DT.Slave GetSlave(Guid id);
|
---|
95 | IEnumerable<DT.Slave> GetSlaves(Expression<Func<Slave, bool>> predicate);
|
---|
96 | Guid AddSlave(DT.Slave dto);
|
---|
97 | void UpdateSlave(DT.Slave dto);
|
---|
98 | void DeleteSlave(Guid id);
|
---|
99 | #endregion
|
---|
100 |
|
---|
101 | #region SlaveGroup Methods
|
---|
102 | DT.SlaveGroup GetSlaveGroup(Guid id);
|
---|
103 | IEnumerable<DT.SlaveGroup> GetSlaveGroups(Expression<Func<SlaveGroup, bool>> predicate);
|
---|
104 | Guid AddSlaveGroup(DT.SlaveGroup dto);
|
---|
105 | void UpdateSlaveGroup(DT.SlaveGroup dto);
|
---|
106 | void DeleteSlaveGroup(Guid id);
|
---|
107 | #endregion
|
---|
108 |
|
---|
109 | #region Resource Methods
|
---|
110 | DT.Resource GetResource(Guid id);
|
---|
111 | IEnumerable<DT.Resource> GetResources(Expression<Func<Resource, bool>> predicate);
|
---|
112 | Guid AddResource(DT.Resource dto);
|
---|
113 | void UpdateResource(DT.Resource dto);
|
---|
114 | void DeleteResource(Guid id);
|
---|
115 | void AssignJobToResource(Guid jobId, Guid resourceId);
|
---|
116 | IEnumerable<DT.Resource> GetAssignedResources(Guid jobId);
|
---|
117 | IEnumerable<DT.Resource> GetParentResources(Guid resourceId);
|
---|
118 | IEnumerable<DT.Resource> GetChildResources(Guid resourceId);
|
---|
119 | IEnumerable<DT.Task> GetJobsByResourceId(Guid resourceId);
|
---|
120 | #endregion
|
---|
121 |
|
---|
122 | #region ResourcePermission Methods
|
---|
123 | DT.ResourcePermission GetResourcePermission(Guid resourceId, Guid grantedUserId);
|
---|
124 | IEnumerable<DT.ResourcePermission> GetResourcePermissions(Expression<Func<ResourcePermission, bool>> predicate);
|
---|
125 | void AddResourcePermission(DT.ResourcePermission dto);
|
---|
126 | void UpdateResourcePermission(DT.ResourcePermission dto);
|
---|
127 | void DeleteResourcePermission(Guid resourceId, Guid grantedUserId);
|
---|
128 | #endregion
|
---|
129 |
|
---|
130 | #region Authorization Methods
|
---|
131 | Permission GetPermissionForTask(Guid taskId, Guid userId);
|
---|
132 | Permission GetPermissionForJob(Guid jobId, Guid userId);
|
---|
133 | Guid GetJobForTask(Guid taskId);
|
---|
134 | #endregion
|
---|
135 |
|
---|
136 | #region Lifecycle Methods
|
---|
137 | DateTime GetLastCleanup();
|
---|
138 | void SetLastCleanup(DateTime datetime);
|
---|
139 | #endregion
|
---|
140 |
|
---|
141 | #region Downtime Methods
|
---|
142 | DT.Downtime GetDowntime(Guid id);
|
---|
143 | IEnumerable<DT.Downtime> GetDowntimes(Expression<Func<Downtime, bool>> predicate);
|
---|
144 | Guid AddDowntime(DT.Downtime dto);
|
---|
145 | void UpdateDowntime(DT.Downtime dto);
|
---|
146 | void DeleteDowntime(Guid id);
|
---|
147 | #endregion
|
---|
148 |
|
---|
149 | #region Statistics Methods
|
---|
150 | Dictionary<Guid, int> GetWaitingTasksByUser();
|
---|
151 | Dictionary<Guid, int> GetWaitingTasksByUserForResources(List<Guid> resourceIds);
|
---|
152 | Dictionary<Guid, int> GetCalculatingTasksByUser();
|
---|
153 | Dictionary<Guid, int> GetCalculatingTasksByUserForResources(List<Guid> resourceIds);
|
---|
154 | DT.Statistics GetStatistic(Guid id);
|
---|
155 | IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate);
|
---|
156 | Guid AddStatistics(DT.Statistics dto);
|
---|
157 | void DeleteStatistics(Guid id);
|
---|
158 | List<DT.UserStatistics> GetUserStatistics();
|
---|
159 | #endregion
|
---|
160 |
|
---|
161 | #region UserPriority Methods
|
---|
162 | IEnumerable<DT.UserPriority> GetUserPriorities(Expression<Func<UserPriority, bool>> predicate);
|
---|
163 | void EnqueueUserPriority(DT.UserPriority userPriority);
|
---|
164 | #endregion
|
---|
165 | }
|
---|
166 | }
|
---|