Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs @ 9385

Last change on this file since 9385 was 9385, checked in by pfleck, 10 years ago

#2030
Replaced lazy loading with specialized queries.
Compiled queries used for Heardbeat queries.
Changed result types to IQueryable<T> for later query modification.

File size: 7.5 KB
Line 
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
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Linq.Expressions;
26using HeuristicLab.Services.Hive.DataAccess;
27using DT = HeuristicLab.Services.Hive.DataTransfer;
28
29namespace HeuristicLab.Services.Hive {
30  public interface IHiveDao {
31    #region Task Methods
32    DT.Task GetTask(Guid id);
33    Task GetTaskDA(Guid id);
34    IEnumerable<DT.Task> GetTasks(Expression<Func<Task, bool>> predicate);
35    IEnumerable<DT.LightweightTask> GetLightweightTasks(Expression<Func<Task, bool>> predicate);
36    IEnumerable<DT.LightweightTask> GetLightweightTasksWithoutStateLog(Expression<Func<Task, bool>> predicate);
37    Guid AddTask(DT.Task dto);
38    void UpdateTaskAndPlugins(DT.Task dto);
39    void UpdateTaskAndStateLogs(DT.Task dto);
40    void UpdateTask(DT.Task dto);
41    void UpdateTaskDA(Task dto);
42    void DeleteTask(Guid id);
43    IEnumerable<TaskInfoForScheduler> GetWaitingTasks(DT.Slave slave);
44    IQueryable<TaskInfoForScheduler> GetWaitingTasksDA(Slave slave);
45    IEnumerable<DT.Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished);
46    DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
47    Task UpdateTaskStateDA(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
48    #endregion
49
50    #region TaskData Methods
51    DT.TaskData GetTaskData(Guid id);
52    IEnumerable<DT.TaskData> GetTaskDatas(Expression<Func<TaskData, bool>> predicate);
53    Guid AddTaskData(DT.TaskData dto);
54    void UpdateTaskData(DT.TaskData dto);
55    void DeleteTaskData(Guid id);
56    #endregion
57
58    #region StateLog Methods
59    DT.StateLog GetStateLog(Guid id);
60    IEnumerable<DT.StateLog> GetStateLogs(Expression<Func<StateLog, bool>> predicate);
61    Guid AddStateLog(DT.StateLog dto);
62    void UpdateStateLog(DT.StateLog dto);
63    void DeleteStateLog(Guid id);
64    #endregion
65
66    #region Job Methods
67    DT.Job GetJob(Guid id);
68    IEnumerable<DT.Job> GetJobs(Expression<Func<Job, bool>> predicate);
69    IEnumerable<JobInfoForScheduler> GetJobInfoForScheduler(Expression<Func<Job, bool>> predicate);
70    Guid AddJob(DT.Job dto);
71    void UpdateJob(DT.Job dto);
72    void DeleteJob(Guid id);
73    #endregion
74
75    #region JobPermission Methods
76    DT.JobPermission GetJobPermission(Guid jobId, Guid grantedUserId);
77    IEnumerable<DT.JobPermission> GetJobPermissions(Expression<Func<JobPermission, bool>> predicate);
78    void AddJobPermission(DT.JobPermission dto);
79    void UpdateJobPermission(DT.JobPermission dto);
80    void DeleteJobPermission(Guid jobId, Guid grantedUserId);
81    void SetJobPermission(Guid jobId, Guid grantedByUserId, Guid grantedUserId, Permission permission);
82    #endregion
83
84    #region Plugin Methods
85    DT.Plugin GetPlugin(Guid id);
86    IEnumerable<DT.Plugin> GetPlugins(Expression<Func<Plugin, bool>> predicate);
87    Guid AddPlugin(DT.Plugin dto);
88    void UpdatePlugin(DT.Plugin dto);
89    void DeletePlugin(Guid id);
90    #endregion
91
92    #region PluginData Methods
93    DT.PluginData GetPluginData(Guid id);
94    IEnumerable<DT.PluginData> GetPluginDatas(Expression<Func<PluginData, bool>> predicate);
95    Guid AddPluginData(DT.PluginData dto);
96    void UpdatePluginData(DT.PluginData dto);
97    void DeletePluginData(Guid id);
98    #endregion
99
100    #region Slave Methods
101    DT.Slave GetSlave(Guid id);
102    Slave GetSlaveDA(Guid id);
103    IEnumerable<DT.Slave> GetSlaves(Expression<Func<Slave, bool>> predicate);
104    Guid AddSlave(DT.Slave dto);
105    void UpdateSlave(DT.Slave dto);
106    void UpdateSlaveDA(Slave dto);
107    void DeleteSlave(Guid id);
108    #endregion
109
110    #region SlaveGroup Methods
111    DT.SlaveGroup GetSlaveGroup(Guid id);
112    IEnumerable<DT.SlaveGroup> GetSlaveGroups(Expression<Func<SlaveGroup, bool>> predicate);
113    Guid AddSlaveGroup(DT.SlaveGroup dto);
114    void UpdateSlaveGroup(DT.SlaveGroup dto);
115    void DeleteSlaveGroup(Guid id);
116    #endregion
117
118    #region Resource Methods
119    DT.Resource GetResource(Guid id);
120    IEnumerable<DT.Resource> GetResources(Expression<Func<Resource, bool>> predicate);
121    Guid AddResource(DT.Resource dto);
122    void UpdateResource(DT.Resource dto);
123    void DeleteResource(Guid id);
124    void AssignJobToResource(Guid taskId, IEnumerable<Guid> resourceIds);
125    IEnumerable<DT.Resource> GetAssignedResources(Guid jobId);
126    IQueryable<Guid> GetAssignedResourcesIdsDA(Guid taskId);
127    IEnumerable<DT.Resource> GetParentResources(Guid resourceId);
128    IEnumerable<Resource> GetParentResourcesDA(Guid resourceId);
129    IEnumerable<Guid> GetParentResourcesIDsDA(Guid resourceId);
130    IQueryable<int> GetNumberOfDowntimesFromParentResourcesAtCurrentTimeDA(Guid resourceId, DowntimeType type);
131    IEnumerable<DT.Resource> GetChildResources(Guid resourceId);
132    IEnumerable<DT.Task> GetJobsByResourceId(Guid resourceId);
133    #endregion
134
135    #region ResourcePermission Methods
136    DT.ResourcePermission GetResourcePermission(Guid resourceId, Guid grantedUserId);
137    IEnumerable<DT.ResourcePermission> GetResourcePermissions(Expression<Func<ResourcePermission, bool>> predicate);
138    void AddResourcePermission(DT.ResourcePermission dto);
139    void UpdateResourcePermission(DT.ResourcePermission dto);
140    void DeleteResourcePermission(Guid resourceId, Guid grantedUserId);
141    #endregion
142
143    #region Authorization Methods
144    Permission GetPermissionForTask(Guid taskId, Guid userId);
145    Permission GetPermissionForJob(Guid jobId, Guid userId);
146    Guid GetJobForTask(Guid taskId);
147    #endregion
148
149    #region Lifecycle Methods
150    DateTime GetLastCleanup();
151    void SetLastCleanup(DateTime datetime);
152    #endregion
153
154    #region Downtime Methods
155    DT.Downtime GetDowntime(Guid id);
156    IEnumerable<DT.Downtime> GetDowntimes(Expression<Func<Downtime, bool>> predicate);
157    Guid AddDowntime(DT.Downtime dto);
158    void UpdateDowntime(DT.Downtime dto);
159    void DeleteDowntime(Guid id);
160    #endregion
161
162    #region Statistics Methods
163    Dictionary<Guid, int> GetWaitingTasksByUser();
164    Dictionary<Guid, int> GetWaitingTasksByUserForResources(List<Guid> resourceIds);
165    Dictionary<Guid, int> GetCalculatingTasksByUser();
166    Dictionary<Guid, int> GetCalculatingTasksByUserForResources(List<Guid> resourceIds);
167    DT.Statistics GetStatistic(Guid id);
168    IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate);
169    Guid AddStatistics(DT.Statistics dto);
170    void DeleteStatistics(Guid id);
171    List<DT.UserStatistics> GetUserStatistics();
172    #endregion
173
174    #region UserPriority Methods
175    IEnumerable<DT.UserPriority> GetUserPriorities(Expression<Func<UserPriority, bool>> predicate);
176    void EnqueueUserPriority(DT.UserPriority userPriority);
177    #endregion
178  }
179}
Note: See TracBrowser for help on using the repository browser.