INDEX
2024-02-27 11:52 - File System RDB Had a thought last night that I could make a relational DB using just a file system monitor Essentially have folders are objects and files are replaces with symbolic links automatically Could I also define a schema in a folder? Let's try just a PERSON relation and add further later # e.g. PERSON_Andrew/was_report_to_PERSON_Michael/[Link, Notes, ...] # Maybe allow spaces and autoreplace later First make 2 person objects and try to auto link them when relation is made find . -type d -maxdepth 3 # Use maxdepth=mindepth to select only certain layers # 1st layer is object definitions - then relations - then relation definitions # Relation definitions are automatically added # On each clock cycle save current state to variables (each depth) -printf '%P\n' # Using from previous code to remove the leading ./ So you have the current state and expected state - calculate expected and then compare -type l # Find links # I can worry later about efficiency - keeping track of states in a file Current state after a bunch of work is a basic linking system that works automatically So "Andrew/parentof_Michael" creates folders "Michael" and "Michael/childof_Andrew" As well as links "Andrew/parentof_Michael/Michael" to "Michael" and viceversa Just want to add these keywords as a pair in some schema # Thinking of columns which are considered one or the other childof|parentof # Wrote some nice code to check rolelist and apply relations as I would expect # Basically greps the role list pairs and saves A|B into variables A and B # Then if the current role is A, use B and viceversa - if grep result empty default to "role" IFS='|' read -r roleA roleB <<< `grep "$role" <<< "$ROLELIST"` [ "$role" == "$roleA" ] && EXProle="$roleB" || EXProle="${roleA:-$role}" Next thing I need to do is use state compare to judge whether a file has been deleted Good thing about this method is I can save the states over multiple ticks - so save old states Something I learned from doing the new blog compiler - save everything into state variables