aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/DB/QueryBuilder/Sharded
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/DB/QueryBuilder/Sharded')
-rw-r--r--lib/public/DB/QueryBuilder/Sharded/IShardMapper.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/public/DB/QueryBuilder/Sharded/IShardMapper.php b/lib/public/DB/QueryBuilder/Sharded/IShardMapper.php
new file mode 100644
index 00000000000..fa00fb68719
--- /dev/null
+++ b/lib/public/DB/QueryBuilder/Sharded/IShardMapper.php
@@ -0,0 +1,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;
+}