Shorten prefix to 2 characters
Using 2 hex characters [0-9a-f] will give us 16 * 16 = 256 root folders which seems more manageable than 4096 (16^3). Assuming a user has 10,000 attachments, they should roughly distribute at ~40 per folder with prefix length 2 rather than ~2.5 per folder with a prefix of 3.
This commit is contained in:
parent
2cd3d5ac16
commit
1262d1d696
2 changed files with 2 additions and 2 deletions
|
@ -35,6 +35,6 @@ exports._getAttachmentName = () => {
|
|||
// _getAttachmentPath :: Unit -> IO Path
|
||||
exports._getAttachmentPath = () => {
|
||||
const name = exports._getAttachmentName();
|
||||
const prefix = name.slice(0, 3);
|
||||
const prefix = name.slice(0, 2);
|
||||
return Path.join(prefix, name);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ const {
|
|||
} = require('../../../../app/types/attachment/write_attachment_data');
|
||||
|
||||
|
||||
const PREFIX_LENGTH = 3;
|
||||
const PREFIX_LENGTH = 2;
|
||||
const NUM_SEPARATORS = 1;
|
||||
const NAME_LENGTH = 64;
|
||||
const PATH_LENGTH = PREFIX_LENGTH + NUM_SEPARATORS + NAME_LENGTH;
|
||||
|
|
Loading…
Reference in a new issue