IBatchMethodsBackend.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
  5. *
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  7. * @author Carl Schwan <carl@carlschwan.eu>
  8. * @author Côme Chilliet <come.chilliet@nextcloud.com>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Group\Backend;
  27. /**
  28. * @brief Optional interface for group backends
  29. * @since 28.0.0
  30. */
  31. interface IBatchMethodsBackend {
  32. /**
  33. * @brief Batch method to check if a list of groups exists
  34. *
  35. * The default implementation in ABackend will just call groupExists in
  36. * a loop. But a GroupBackend implementation should provides a more optimized
  37. * override this method to provide a more optimized way to execute this operation.
  38. *
  39. * @param list<string> $gids
  40. * @return list<string> the list of group that exists
  41. * @since 28.0.0
  42. */
  43. public function groupsExists(array $gids): array;
  44. /**
  45. * @brief Batch method to get the group details of a list of groups
  46. *
  47. * The default implementation in ABackend will just call getGroupDetails in
  48. * a loop. But a GroupBackend implementation should override this method
  49. * to provide a more optimized way to execute this operation.
  50. *
  51. * @throw \RuntimeException if called on a backend that doesn't implements IGroupDetailsBackend
  52. *
  53. * @return array<string, array{displayName?: string}>
  54. * @since 28.0.0
  55. */
  56. public function getGroupsDetails(array $gids): array;
  57. }