summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore/Mapper.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-11-02 14:42:36 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2016-11-02 21:31:24 +0100
commit049bcae29ebf6106b33dd44f3be30e2a8486cd98 (patch)
treeb0f7f982d1d8d29ba932867a120db1cbeef10d86 /lib/private/Files/ObjectStore/Mapper.php
parentdada3ffb51ce9d941b15f1e3fdc1ce292acebb69 (diff)
downloadnextcloud-server-049bcae29ebf6106b33dd44f3be30e2a8486cd98.tar.gz
nextcloud-server-049bcae29ebf6106b33dd44f3be30e2a8486cd98.zip
Allow setting a maximun number of buckets for multibucket
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/ObjectStore/Mapper.php')
-rw-r--r--lib/private/Files/ObjectStore/Mapper.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/Files/ObjectStore/Mapper.php b/lib/private/Files/ObjectStore/Mapper.php
index bfb4e998150..81f8a9e3fa5 100644
--- a/lib/private/Files/ObjectStore/Mapper.php
+++ b/lib/private/Files/ObjectStore/Mapper.php
@@ -44,10 +44,12 @@ class Mapper {
}
/**
+ * @param int $numBuckets
* @return string
*/
- public function getBucket() {
+ public function getBucket($numBuckets = 64) {
$hash = md5($this->user->getUID());
- return substr($hash, 0, 3);
+ $num = hexdec(substr($hash, 0, 4));
+ return (string)($num % $numBuckets);
}
-} \ No newline at end of file
+}