blob: a5694b06507eb3e501d37898be7a218fc06a4a45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Robin Appelman <robin@icewind.nl>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\DB\QueryBuilder\Sharded;
use OCP\DB\QueryBuilder\Sharded\IShardMapper;
/**
* Map string key to an int-range by hashing the key
*/
class RoundRobinShardMapper implements IShardMapper {
public function getShardForKey(int $key, int $count): int {
return $key % $count;
}
}
|