IShardMapper.php 524 B

12345678910111213141516171819202122232425
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Robin Appelman <robin@icewind.nl>
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\DB\QueryBuilder\Sharded;
  8. /**
  9. * Implementation of logic of mapping shard keys to shards.
  10. * @since 30.0.0
  11. */
  12. interface IShardMapper {
  13. /**
  14. * Get the shard number for a given shard key and total shard count
  15. *
  16. * @param int $key
  17. * @param int $count
  18. * @return int
  19. * @since 30.0.0
  20. */
  21. public function getShardForKey(int $key, int $count): int;
  22. }