aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/DB/QueryBuilder/Sharded/IShardMapper.php
blob: fa00fb68719cdf06b952c89d611427c69034d241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

declare(strict_types=1);
/**
 * SPDX-FileCopyrightText: 2024 Robin Appelman <robin@icewind.nl>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCP\DB\QueryBuilder\Sharded;

/**
 * Implementation of logic of mapping shard keys to shards.
 * @since 30.0.0
 */
interface IShardMapper {
	/**
	 * Get the shard number for a given shard key and total shard count
	 *
	 * @param int $key
	 * @param int $count
	 * @return int
	 * @since 30.0.0
	 */
	public function getShardForKey(int $key, int $count): int;
}