by hayst4ck on 6/9/2023, 8:07:34 AM
Frequently people will ask for a very specific thing, not understanding the greater context of what they are asking for. If they knew the greater context, then they would be asking different questions.
I suspect this question is one of those questions, but since this question feels foreign, I am probably the one who doesn't understand the greater context.
Why don't you need replication? What are the limitations you have (economic?) that resulted in this architecture?
An example question might be, what value does the directory structure add over just hashing the file, storing the file by it's hash in the same directory with all the other files, and then referencing the hash in your SQL?
by compressedgas on 6/8/2023, 4:13:46 PM
I was thinking about the BSD utility mtree https://man.freebsd.org/cgi/man.cgi?mtree(8) then I remembered the recently posted https://github.com/mactat/framed
My backend application is split into an SQL database and a filesystem with user data.
Each folder in the root application directory belongs to a user (identified by id), and subsequent subfolders identify a project. There are certain requirements for the name of each user folder and each project folder, and inside each project folder some other files and folders must necessarily exist, and extra ones should never.
I'm wondering if a tool or type of filesystem exists that lets me enforce structure, much like an SQL database would enforce relationships and datatypes in a given column. I could have written a script to do such validations, but it seems like a frequent enough problem that a general-purpose tool should exist, and it would be easier to maintain a bunch of rule files over a complex script.
Validations would include: - in this depth of filesystem, only folders can exist (no files), and should match this regex - files named "projectCover.png" under a project folder should not exceed a certain file size - each project folder should have a folder named "uploads", and for each file inside it, a "thumbnails/<file>.png" should also exist.
Another validation isn't as trivial: database rows have file paths which should point to images in the filesystem, and I would wish to validate that these indeed exist. Storing binaries in the filesystem would remove these possible data inconsistencies, but has practical issues.