emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] Re: [BUG] org-attach-id-ts-folder-format fails on customi


From: Max Nikulin
Subject: Re: [PATCH v3] Re: [BUG] org-attach-id-ts-folder-format fails on customized IDs [9.6 (9.6-??-2e9999783)]
Date: Thu, 11 Aug 2022 21:43:18 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 11/08/2022 11:19, Ihor Radchenko wrote:
Max Nikulin writes:

I slightly dislike the "___xx" compared to "______" because it will
create a proliferation of top-level folders as opposed to cramping the
non-standard IDs into a single "______" folder.

I believed that proliferation of folders is for purpose. Intermediate
directories allows to avoid excessive number of files in single
directory. ext4 with directory tree index usually is not the case, but
other filesystems may have rather poor performance when too much files
are stuffed into single folder. Some applications become really slow for
huge directories.

I was referring to TS style timestamp resolver here. It is designed to
group directories by creation time, not to distribute them homogeneously.

My bad, I have realizes that my idea of mapping

    "x" -> "______x/x"
    "xy" -> "_____xy/xy"

was a really bad one. It leads to a separate directory for each short ID. However I still believe that the purpose of `org-attach-id-ts-folder-format' is avoid concentration of huge number of file in a single directory. Distribution of attachments over subdirectories is not perfectly even but it still works reasonably well for long-lasting projects while IDs follow assumed format and month is included into directory names.

Back to the original problem. First of all, I believe that if a user decided to use non-standard IDs then it is their responsibility to customize `org-attach-id-to-path-function-list' and to provide a function that implements alternative layout of attachment files. Depending on expected amount, they may be put into single directory, spread using some hash function, or accordingly to project structure. So today I am against default fallback directories especially in `org-attach-id-ts-folder-format'.

I believe that interaction between `org-attach-dir-from-id' and members of `org-attach-id-to-path-function-list' could be improved. If a too short ID is passed to `org-attach-id-uuid-folder-format', `org-attach-id-ts-folder-format', or a user-defined function, they may return nil and `org-attach-dir-from-id' should try next element from the list. If nothing succeeds then a user error should be signaled demanding to implement a strategy to properly deal with peculiar IDs.

There should be no problem to put single character IDs into a common directory (UUID case), but there are enough variants for 5 characters long names to create delayed performance problem. The worst case is when a user decides to use some common prefix, e.g. "id-" before UUID and all files go to the same directory. On the other hand I do not think that code should detect such cases.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]