On Sun, Jan 28, 2018 at 09:30:31PM +0100, Andrew Barchuk wrote:
> Hi everyone,
> > three possible solutions for splitting distfiles were listed:
> There's another option to use character ranges for each directory
> computed in a way to have the files distributed evenly. One way to do
> that is to use filename prefix of dynamic length so that each range
> holds the same number of files. E.g. we would have Ab/, Ap/, Ar/ but
> texlive-module-te/, texlive-module-th/, texlive-module-ti/. A similar
> but simpler option is to use file names as range bounds (the same way
> dictionaries use words to demarcate page bounds): each directory will
> have a name of the first file located inside. This way files will be
> distributed evenly and it's still easy to pick a correct directory where
> a file will be located manually.
This was discussed early on, but thank you for the reminder, as it got
dropped from later discussions.

> [snip code]
> Using the approach above the files will distributed evenly among the
> directories keeping the possibility to determine the directory for a
> specific file by hand. It's possible if necessary to keep the directory
> structure unchanged for very long time and it will likely stay
> well-balanced. Picking a directory for a file is very cheap. The only
> obvious downside I see is that it's necessary to know list of
> directories to pick the correct one (can be mitigated by caching the
> list of directories if important). If it's desirable to make directory
> names shorter or to look less like file names it's fairly easy to
> achieve by keeping only unique prefixes of directories. For example:
As for the problem you describe, one of the requirements in the
discussion is that given ONLY the file or filename, and NOTHING ELSE, it
should be possible to determine where in a hierarchy it should go. No
prior knowledge about the hierarchy was permitted. Some parties might
answer that you just need an index file then, but that means you have to
keep the index file in sync often.

It's a superbly readable result (in the general class of perfect hashes
based on lots of well-known input). The class of solution suffers
another problem in addition the one you noted: if input changes
sufficiently, then rebalancing is expensive/hard.

As a concrete example, say we add a new category for something something
with lots of common prefixes in distfiles. 
dev-scratch/ as an example, where all distfiles start with 'scratch-'.
Unless we know up-front that we're going to add a thousand distfiles
here (not unreasonable, dev-python is ~1800 packages), they might start
by going into the 'sc' directory, but later we want them to be in
'scratch', as the tree is unweighted otherwise.

Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
E-Mail   : robb...@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

Attachment: signature.asc
Description: Digital signature

Reply via email to