You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CeQueueMapper.java 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.db.ce;
  21. import java.util.List;
  22. import javax.annotation.CheckForNull;
  23. import javax.annotation.Nullable;
  24. import org.apache.ibatis.annotations.Param;
  25. import org.apache.ibatis.session.RowBounds;
  26. import org.sonar.db.Pagination;
  27. public interface CeQueueMapper {
  28. List<CeQueueDto> selectByMainComponentUuid(@Param("mainComponentUuid") String mainComponentUuid);
  29. List<CeQueueDto> selectAllInAscOrder();
  30. List<CeQueueDto> selectByQueryInDescOrder(@Param("query") CeTaskQuery query, RowBounds rowBounds);
  31. int countByQuery(@Param("query") CeTaskQuery query);
  32. List<String> selectEligibleForPeek(@Param("pagination") Pagination pagination);
  33. @CheckForNull
  34. CeQueueDto selectByUuid(@Param("uuid") String uuid);
  35. /**
  36. * Select all pending tasks
  37. */
  38. List<CeQueueDto> selectPending();
  39. /**
  40. * Select all pending tasks which have already been started.
  41. */
  42. List<CeQueueDto> selectWornout();
  43. /**
  44. * The tasks that are in the in-progress status for too long
  45. */
  46. List<CeQueueDto> selectInProgressStartedBefore(@Param("date") long date);
  47. /**
  48. * Select all tasks whose worker UUID is not present in {@code knownWorkerUUIDs}
  49. */
  50. void resetTasksWithUnknownWorkerUUIDs(@Param("knownWorkerUUIDs") List<String> knownWorkerUUIDs, @Param("updatedAt") long updatedAt);
  51. /**
  52. * Reset all IN_PROGRESS TASKS
  53. */
  54. void resetAllInProgressTasks(@Param("updatedAt") long updatedAt);
  55. int countByStatusAndMainComponentUuid(@Param("status") CeQueueDto.Status status, @Nullable @Param("mainComponentUuid") String mainComponentUuid);
  56. @CheckForNull
  57. Long selectCreationDateOfOldestPendingByMainComponentUuid(@Nullable @Param("mainComponentUuid") String mainComponentUuid);
  58. List<QueueCount> countByStatusAndMainComponentUuids(@Param("status") CeQueueDto.Status status, @Param("mainComponentUuids") List<String> mainComponentUuids);
  59. void insert(CeQueueDto dto);
  60. int resetToPendingForWorker(@Param("workerUuid") String workerUuid, @Param("updatedAt") long updatedAt);
  61. int updateIf(@Param("uuid") String uuid,
  62. @Param("new") UpdateIf.NewProperties newProperties,
  63. @Param("old") UpdateIf.OldProperties oldProperties);
  64. int deleteByUuid(@Param("uuid") String uuid, @Nullable @Param("deleteIf") DeleteIf deleteIf);
  65. }