The Trunk: Files-nice.79.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Files-nice.79.mcz

commits-2
Nicolas Cellier uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-nice.79.mcz

==================== Summary ====================

Name: Files-nice.79
Author: nice
Time: 27 March 2010, 10:58:18.301 pm
UUID: 1a2f808c-0bf0-504b-abba-4607dec810b2
Ancestors: Files-ul.78

Fix an _ in comment

=============== Diff against Files-ul.78 ===============

Item was changed:
  ReadWriteStream subclass: #CompressedSourceStream
  instanceVariableNames: 'segmentFile segmentSize nSegments segmentTable segmentIndex dirty endOfFile'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Files-System'!
 
+ !CompressedSourceStream commentStamp: 'nice 3/24/2010 07:36' prior: 0!
- !CompressedSourceStream commentStamp: 'di 11/3/2003 17:58' prior: 0!
  I implement a file format that compresses segment by segment to allow incremental writing and browsing.  Note that the file can only be written at the end.
 
  Structure:
  segmentFile The actual compressed file.
  segmentSize This is the quantum of compression.  The virtual file is sliced up
  into segments of this size.
  nSegments The maximum number of segments to which this file can be grown.
  endOfFile The user's endOfFile pointer.
  segmentTable When a file is open, this table holds the physical file positions
  of the compressed segments.
  segmentIndex Index of the most recently accessed segment.
 
  Inherited from ReadWriteStream...
  collection The segment buffer, uncompressed
  position This is the position *local* to the current segment buffer
  readLimit ReadLimit for the current buffer
  writeLimit WriteLimit for the current buffer
 
  Great care must be exercised to distinguish between the position relative to the segment buffer and the full file position (and, or course, the segment file position ;-).
 
  The implementation defaults to a buffer size of 20k, and a max file size of 34MB (conveniently chosen to be greater than the current 33MB limit of source code pointers).  The format of the file is as follows:
  segmentSize 4 bytes
  nSegments 4 bytes
  endOfFile 4 bytes
  segmentTable 4 bytes * (nSegments+1)
  beginning of first compressed segment
 
  It is possible to override the default allocation by sending the message #segmentSize:nSegments: immediately after opening a new file for writing, as follows:
 
+ bigFile := (CompressedSourceStream on: (FileStream newFileNamed: 'biggy.stc'))
- bigFile _ (CompressedSourceStream on: (FileStream newFileNamed: 'biggy.stc'))
  segmentSize: 50000 maxSize: 200000000
 
  The difference between segment table entries reveals the size of each compressed segment.  When a file is being written, it may lack the final segment, but any flush, position:, or close will force a dirty segment to be written.!