The &quot;objects and translators&quot; 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 &quot;kinds&quot; of tar files (this one is a web page, that one is an activity bundle). Note that the &quot;rebundle&quot; 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 &quot;most default&quot; 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&#39;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>
&nbsp;<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 &lt;<a href="mailto:bmschwar@fas.harvard.edu">bmschwar@fas.harvard.edu</a>&gt; 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. &nbsp;I call it the &quot;Objects and<br>
Translators&quot; model. &nbsp;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). &nbsp;The datastore provides these objects for use by<br>
Activities. &nbsp;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. &nbsp;Each Translator<br>
has a specified set of input types on which it can act. &nbsp;The user, having<br>
selected a particular object, should be provided with a list of all<br>
compatible Translators. &nbsp;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. &nbsp;To the user, this looks very much like a<br>
directory hierarchy. &nbsp;However, because each &quot;directory&quot; 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. &nbsp;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. &nbsp;I, and most people, have done this by blowing up the image and<br>
performing &quot;Print Screen&quot;, or perhaps opening the PDF in the GIMP, which<br>
rasterizes it. &nbsp;However, there is a much better solution, provided by<br>
xpdf&#39;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. &nbsp;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. &nbsp;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. &nbsp;For example,<br>
one could also provide a PDF-&gt;PNG rasterizer, a ODT-&gt;PDF renderer, or a<br>
Theora-&gt;JPG frames decompressor. &nbsp;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>