The "objects and translators" model, as described, does not have any easy way to retar a bundle; nor is it easy to figure out how to assign different mime types to different "kinds" of tar files (this one is a web page, that one is an activity bundle). Note that the "rebundle" problem is not so trivial - what do you do with the metadata on the subfiles?<br>
<br>Let me try to sketch out the problem of bundles, with everything a good solution should enable.<br><br>1. In journal, the "most default" view shows only bundles, is not cluttered with all subfiles.<br>2. Bundles have their own metadata, and a mime-type that reflects their holistic nature (a set of photos, a web page, an activity)<br>
3. Subfiles inherit (some?) bundle metadata, but can also have their own metadata.<br>4. Some subfiles, which make no sense on their own, are hidden by default (dotted files)<br>5. Possible to grab a piece of a bundle and start treating it as a separate top-level object.<br>
6. Possible to edit a piece of a bundle as if it were a top-level object, yet keep it as part of the bundle. This creates a new version of the whole bundle, with the edited file.<br>7. Possible to take a top-level object and add it to a bundle.<br>
8. Possible to remove (delete) an object from a bundle.<br>9. Possible to import/ export bundles as single files (zip/tar) to external media/over the net<br>10. Possible to import/export bundles as directories to external media.<br>
11. For easier porting of legacy apps: ability to open a subfile in context, with the directory structure of the bundle extracted, so that relative paths work.<br><br>...<br><br>I think it is clear from the above list that moving back and forth from bundle to file view should be as transparent as possible. Internal storage could be as separate files or as zipped/tarred groups; either way, there would need to be a storage of stubs/pointers to stand in for the other model.<br>
<br>Here's one proposal to kick things off:<br>External format:<br>metadata for a traditional file is represented on external media by an invisible file in the same directory, with a related name, which contains json.<br>
bundles are represented on external media by a zip, which politely extracts itself to a subdirectory.<br>metadata for bundles is represented by an invisible file next to the zip. This file is a zip which extracts to the same subdirectory, putting global metadata in an invisible file in the root, and subfile metadata in dotfiles as above.<br>
<br>Internal format:<br>Same as external format. Glucose knows how to unpack and repack the bundles. There is no pretense that Glucose maintains any integrity/signatures for the bundles. When editing as in option 6 above, the bundle is extracted (see option 11 above) and then repacked on *each save* of the subfile. Each non-hidden subfile is also represented by a metadata-only datastore pointer into the bundle, for journal searches.<br>
<br>Note: this proposal is less than ideal in some ways. For one instance: small changes to large files inside a zip are not good for delta-based storage. For another, zip has no way to include empty directories, which might be important for directory structure in some legacy cases. It assumes relatively large atomic saves in any subfile.<br>
<br>Jameson<br><br><div class="gmail_quote">On Wed, Jun 11, 2008 at 9:37 AM, Benjamin M. Schwartz <<a href="mailto:bmschwar@fas.harvard.edu">bmschwar@fas.harvard.edu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
I have a proposal for how to manage objects in the datastore, to resolve<br>
the various issues we have discussed. I call it the "Objects and<br>
Translators" model. The fundamental idea is this: the datastore is a<br>
flat, non-hierarchical listing of objects (versioned, but that does not<br>
come into play here). The datastore provides these objects for use by<br>
Activities. However, the datastore (or perhaps the Journal) also contains<br>
a new element: Translators.<br>
<br>
A Translator is a non-interactive object processing machine that takes an<br>
object as input and returns a set of objects as output. Each Translator<br>
has a specified set of input types on which it can act. The user, having<br>
selected a particular object, should be provided with a list of all<br>
compatible Translators. Clicking on a Translator should show the list of<br>
output objects that Translator would generate for this input object, and<br>
the user may repeat this process on each of those objects as well.<br>
<br>
This model allows us to reproduce the usual sorts of directory<br>
hierarchies, simply by using a group object (I think of it as a .tar file)<br>
and an untar Translator. To the user, this looks very much like a<br>
directory hierarchy. However, because each "directory" is in fact a<br>
first-class object, it can also be associated with Activity instances, or<br>
passed from one XO to another over the network, etc.<br>
<br>
The Translator system is appealing to me because it can provide far more<br>
than a simple storage hierarchy. For example, I have often had to extract<br>
a particular image from a PDF file, in order to include it in a class<br>
project. I, and most people, have done this by blowing up the image and<br>
performing "Print Screen", or perhaps opening the PDF in the GIMP, which<br>
rasterizes it. However, there is a much better solution, provided by<br>
xpdf's command-line utils, which allows one to split a PDF into its<br>
component images and text, losslessly.<br>
<br>
Almost nobody uses these tools, because they are command-line only, and<br>
obscure. It would be trivial to wrap them up into a Translator, though,<br>
and then every PDF, in addition to showing options for viewing in Read,<br>
would show an option for splitting into it components, for further<br>
editing. Nothing could be more in keeping with our goal of creating an<br>
editable world.<br>
<br>
You can easily think of many other interesting Translators. For example,<br>
one could also provide a PDF->PNG rasterizer, a ODT->PDF renderer, or a<br>
Theora->JPG frames decompressor. The APIs should be designed so that<br>
Translators can be lazy, computing the contents of output objects only<br>
when necessary.<br>
<br>
Translators provide tremendously powerful object management, with a simple<br>
path to implementation.<br>
<br>
- --Ben<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v2.0.9 (GNU/Linux)<br>
Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org" target="_blank">http://enigmail.mozdev.org</a><br>
<br>
iEYEARECAAYFAkhP8SkACgkQUJT6e6HFtqRQrACfcd5ntZ1ZXovZtTVI5k4LEG96<br>
oDwAnjswhuiV1uKJ5cWhVV9N6uFNgT6E<br>
=x7ie<br>
-----END PGP SIGNATURE-----<br>
<div><div></div><div class="Wj3C7c">_______________________________________________<br>
Sugar mailing list<br>
<a href="mailto:Sugar@lists.laptop.org">Sugar@lists.laptop.org</a><br>
<a href="http://lists.laptop.org/listinfo/sugar" target="_blank">http://lists.laptop.org/listinfo/sugar</a><br>
</div></div></blockquote></div><br>