eliminate MonadWriteFile in favour of MonadCache#600
eliminate MonadWriteFile in favour of MonadCache#600patritzenfeld wants to merge 7 commits intodevfrom
MonadWriteFile in favour of MonadCache#600Conversation
|
For the particular case of So why is it not simply |
|
In fact, |
| adFilename :: FilePath | ||
| adFilename = [i|#{path}Diagram.svg|] | ||
| drawAdToFile path conf ad = cache path ".svg" "ActivityDiagram-" (conf,ad) | ||
| $ drawPlantUmlSvg . uncurry convertToPlantUML' |
There was a problem hiding this comment.
Die bereits vorhandenen cache-Nutzungen hier im Repo sind alle irgendwelche fancyeren Verwendungen. Also zum Beispiel mit Kodierung von Aufgabentypen in die Dateinamen:
modelling-tasks/src/Modelling/PetriNet/Diagram.hs
Lines 95 to 98 in 992b725
modelling-tasks/src/Modelling/CdOd/Output.hs
Lines 193 to 196 in 992b725
Mir ist nicht klar, was davon essentiell, nice to have, oder vielleicht sogar unidiomatisch ist (fmidue/autotool-capabilities#29), und schon gar nicht, ob das Konsequenzen dafür hat, wie der Aufruf hier aussehen sollte.
There was a problem hiding this comment.
Da bin ich mir auch nicht sicher. Fürs Caching wird ein SHA256 Hash verwendet, es sollte also extrem unwahrscheinlich sein, dass eine Kollision auftritt, auch wenn diese Informationen stattdessen mitgehasht werden.
Diese Teile dem Dateinamen hinzuzufügen hilft vielleicht dabei, die erstellten Dateien später besser einer bestimmten Aufgabe zuordnen zu können, wenn mal etwas debugt werden muss?
There was a problem hiding this comment.
Es gab mal eine lange verwandte Diskussion ab hier: https://git.uni-due.de/fmi/autotool-dev/-/commit/cab9de03013d848ed5628e7744faa6c78465bbb3#note_209675
MonadWriteFileis in principle always replaceable byMonadCache, but concerning the simple file writing done in the apps, it seems unnecessary to include the input's hash in the final filename as collisions are not really a concern for those.Example:
modelling-tasks/legacy-app/instance2pic.hs
Lines 35 to 43 in f1764a0
where a filename like
filePrefix-HashOfOdInstance.svgis used, even though justfilePrefix.svgwould probably suffice. But I guess there is no harm in it either.