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.Net.Security;
|
---|
25 | using System.ServiceModel;
|
---|
26 | using HeuristicLab.Services.Hive.DataTransfer;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Services.Hive.ServiceContracts {
|
---|
29 |
|
---|
30 | [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
|
---|
31 | public interface IHiveService {
|
---|
32 | #region Task Methods
|
---|
33 | [OperationContract]
|
---|
34 | Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds);
|
---|
35 |
|
---|
36 | [OperationContract]
|
---|
37 | Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData);
|
---|
38 |
|
---|
39 | [OperationContract]
|
---|
40 | Task GetTask(Guid taskId);
|
---|
41 |
|
---|
42 | [OperationContract]
|
---|
43 | IEnumerable<Task> GetTasks();
|
---|
44 |
|
---|
45 | [OperationContract]
|
---|
46 | IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds);
|
---|
47 |
|
---|
48 | [OperationContract]
|
---|
49 | IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent);
|
---|
50 |
|
---|
51 | [OperationContract]
|
---|
52 | IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId);
|
---|
53 |
|
---|
54 | [OperationContract]
|
---|
55 | TaskData GetTaskData(Guid taskId);
|
---|
56 |
|
---|
57 | [OperationContract]
|
---|
58 | void UpdateTask(Task taskDto);
|
---|
59 |
|
---|
60 | [OperationContract]
|
---|
61 | void UpdateTaskData(Task taskDto, TaskData taskDataDto);
|
---|
62 |
|
---|
63 | [OperationContract]
|
---|
64 | void DeleteTask(Guid taskId);
|
---|
65 |
|
---|
66 | [OperationContract]
|
---|
67 | void DeleteChildTasks(Guid parentTaskId);
|
---|
68 |
|
---|
69 | [OperationContract]
|
---|
70 | Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
71 | #endregion
|
---|
72 |
|
---|
73 | #region Task Control Methods
|
---|
74 | [OperationContract]
|
---|
75 | void StopTask(Guid taskId);
|
---|
76 |
|
---|
77 | [OperationContract]
|
---|
78 | void PauseTask(Guid taskId);
|
---|
79 |
|
---|
80 | [OperationContract]
|
---|
81 | void RestartTask(Guid taskId);
|
---|
82 | #endregion
|
---|
83 |
|
---|
84 | #region Job Methods
|
---|
85 | [OperationContract]
|
---|
86 | Job GetJob(Guid id);
|
---|
87 |
|
---|
88 | /// <summary>
|
---|
89 | /// Returns all task for the current user
|
---|
90 | /// </summary>
|
---|
91 | [OperationContract]
|
---|
92 | IEnumerable<Job> GetJobs();
|
---|
93 |
|
---|
94 | /// <summary>
|
---|
95 | /// Returns all task in the hive (only for admins)
|
---|
96 | /// </summary>
|
---|
97 | /// <returns></returns>
|
---|
98 | [OperationContract]
|
---|
99 | IEnumerable<Job> GetAllJobs();
|
---|
100 |
|
---|
101 | [OperationContract]
|
---|
102 | Guid AddJob(Job jobDto);
|
---|
103 |
|
---|
104 | [OperationContract]
|
---|
105 | void UpdateJob(Job jobDto);
|
---|
106 |
|
---|
107 | [OperationContract]
|
---|
108 | void DeleteJob(Guid JobId);
|
---|
109 | #endregion
|
---|
110 |
|
---|
111 | #region JobPermission Methods
|
---|
112 | [OperationContract]
|
---|
113 | void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission);
|
---|
114 |
|
---|
115 | [OperationContract]
|
---|
116 | void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
|
---|
117 |
|
---|
118 | [OperationContract]
|
---|
119 | IEnumerable<JobPermission> GetJobPermissions(Guid jobId);
|
---|
120 |
|
---|
121 | [OperationContract]
|
---|
122 | bool IsAllowedPrivileged(); // current user may execute privileged task
|
---|
123 | #endregion
|
---|
124 |
|
---|
125 | #region Login Methods
|
---|
126 | [OperationContract]
|
---|
127 | void Hello(Slave slave);
|
---|
128 |
|
---|
129 | [OperationContract]
|
---|
130 | void GoodBye(Guid slaveId);
|
---|
131 | #endregion
|
---|
132 |
|
---|
133 | #region Heartbeat Methods
|
---|
134 | [OperationContract]
|
---|
135 | List<MessageContainer> Heartbeat(Heartbeat heartbeat);
|
---|
136 | #endregion
|
---|
137 |
|
---|
138 | #region Plugin Methods
|
---|
139 | [OperationContract]
|
---|
140 | Plugin GetPlugin(Guid pluginId);
|
---|
141 |
|
---|
142 | [OperationContract]
|
---|
143 | Plugin GetPluginByHash(byte[] hash);
|
---|
144 |
|
---|
145 | [OperationContract]
|
---|
146 | [FaultContract(typeof(PluginAlreadyExistsFault))]
|
---|
147 | Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
|
---|
148 |
|
---|
149 | [OperationContract]
|
---|
150 | IEnumerable<Plugin> GetPlugins();
|
---|
151 |
|
---|
152 | [OperationContract]
|
---|
153 | IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
|
---|
154 |
|
---|
155 | [OperationContract]
|
---|
156 | void DeletePlugin(Guid pluginId);
|
---|
157 | #endregion
|
---|
158 |
|
---|
159 | #region ResourcePermission Methods
|
---|
160 | [OperationContract]
|
---|
161 | void GrantResourcePermissions(Guid resourceId, Guid[] grantedUserIds);
|
---|
162 |
|
---|
163 | [OperationContract]
|
---|
164 | void RevokeResourcePermissions(Guid resourceId, Guid[] grantedUserIds);
|
---|
165 |
|
---|
166 | [OperationContract]
|
---|
167 | IEnumerable<ResourcePermission> GetResourcePermissions(Guid resourceId);
|
---|
168 | #endregion
|
---|
169 |
|
---|
170 | #region Resource Methods
|
---|
171 | [OperationContract]
|
---|
172 | IEnumerable<Resource> GetChildResources(Guid resourceId);
|
---|
173 | #endregion
|
---|
174 |
|
---|
175 | #region Slave Methods
|
---|
176 | [OperationContract]
|
---|
177 | Guid AddSlave(Slave slave);
|
---|
178 |
|
---|
179 | [OperationContract]
|
---|
180 | Guid AddSlaveGroup(SlaveGroup slaveGroup);
|
---|
181 |
|
---|
182 | [OperationContract]
|
---|
183 | Slave GetSlave(Guid slaveId);
|
---|
184 |
|
---|
185 | [OperationContract]
|
---|
186 | SlaveGroup GetSlaveGroup(Guid slaveGroupId);
|
---|
187 |
|
---|
188 | [OperationContract]
|
---|
189 | IEnumerable<Slave> GetSlaves();
|
---|
190 |
|
---|
191 | [OperationContract]
|
---|
192 | IEnumerable<SlaveGroup> GetSlaveGroups();
|
---|
193 |
|
---|
194 | [OperationContract]
|
---|
195 | void UpdateSlave(Slave slave);
|
---|
196 |
|
---|
197 | [OperationContract]
|
---|
198 | void UpdateSlaveGroup(SlaveGroup slaveGroup);
|
---|
199 |
|
---|
200 | [OperationContract]
|
---|
201 | void DeleteSlave(Guid slaveId);
|
---|
202 |
|
---|
203 | [OperationContract]
|
---|
204 | void DeleteSlaveGroup(Guid slaveGroupId);
|
---|
205 |
|
---|
206 | [OperationContract]
|
---|
207 | void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
|
---|
208 |
|
---|
209 | [OperationContract]
|
---|
210 | void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
|
---|
211 |
|
---|
212 | [OperationContract]
|
---|
213 | Guid GetResourceId(string resourceName);
|
---|
214 |
|
---|
215 | [OperationContract]
|
---|
216 | IEnumerable<Task> GetTasksByResourceId(Guid resourceId);
|
---|
217 |
|
---|
218 | [OperationContract]
|
---|
219 | void TriggerEventManager(bool force);
|
---|
220 |
|
---|
221 | [OperationContract]
|
---|
222 | int GetNewHeartbeatInterval(Guid slaveId);
|
---|
223 | #endregion
|
---|
224 |
|
---|
225 | #region Downtime Methods
|
---|
226 | [OperationContract]
|
---|
227 | Guid AddDowntime(Downtime downtime);
|
---|
228 |
|
---|
229 | [OperationContract]
|
---|
230 | void DeleteDowntime(Guid downtimeId);
|
---|
231 |
|
---|
232 | [OperationContract]
|
---|
233 | void UpdateDowntime(Downtime downtime);
|
---|
234 |
|
---|
235 | [OperationContract]
|
---|
236 | IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId);
|
---|
237 | #endregion
|
---|
238 |
|
---|
239 | #region User Methods
|
---|
240 | [OperationContract]
|
---|
241 | string GetUsernameByUserId(Guid userId);
|
---|
242 |
|
---|
243 | [OperationContract]
|
---|
244 | Guid GetUserIdByUsername(string username);
|
---|
245 | #endregion
|
---|
246 |
|
---|
247 | #region UserPriorities Methods
|
---|
248 | [OperationContract]
|
---|
249 | IEnumerable<UserPriority> GetUserPriorities();
|
---|
250 | #endregion
|
---|
251 |
|
---|
252 | #region Statistics Methods
|
---|
253 | [OperationContract]
|
---|
254 | IEnumerable<Statistics> GetStatistics();
|
---|
255 | [OperationContract]
|
---|
256 | IEnumerable<Statistics> GetStatisticsForTimePeriod(DateTime from, DateTime to);
|
---|
257 | #endregion
|
---|
258 | }
|
---|
259 | }
|
---|