I am trying to work out why the MAExternalFileModel
does what it
does the way it does it.
There are different file-models that you can use with Magritte. The
idea is that you set the #kind: of an MAFileDescription to one of the
subclasses of MAFileModel.
Earlier versions of Magritte used MAMemoryFileModel and kept all the
data within a ByteArray in the memory. This is not really practicable
for bigger files.
MAMexternalFileModel tries to solve this problem. It manages the
files on the file-system. From the programmer this looks the same as
if the file would be in memory, as it is loaded and written out as
necessary.
- The #baseDirectory is the place where Magritte puts its file-
database. Keep this value to nil to make it default to a subdirectory
next to the Squeak image. (also check the method comment)
- #baseUrl is a nice optimization to allow Apache (or any other Web
Server) to directly serve the files. The #baseUrl is an absolute URL
that is used to generate the path to the file. If you have one
specified the file data does not go trough the image anymore, but
instead is directly served trough the Web Server (assuming that you
have a propre setup).
Now you might wonder why the files are in directories like the
following one?
/files/9d/bsy8kyp45g0q7blphknk48zujap2wd/earthmap1k.jpg
1 2 3 4
(1) Is the #baseDirectory as specified in the settings.
(2) Are 256 directories named '00' to 'FF' to avoid having thousands
of files in the same directory. Unfortunately this leads to problems
with the Squeak file primitives and some filesystems don't handle
that well. This part is generated at random.
(3) This is a secure id, similar to the Seaside session key. It is
generated at random and provides sort of a security system that even
works trough Apache (you have to disable directory listings of
course): if you don't know the file-name you cannot access the file.
(4) This is the original file-name. In the future there will be other
cached versions of the file be stored there, for example resized
images, etc.
HTH,
Lukas
problems with filesystems and Squeak if there are thous
So first of all
could you please explain
Keith
_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Lukas Renggli
http://www.lukas-renggli.ch