Squeak Class Documentation category index | class index  
 
IndexFile
  category: Network-Mail Reader
  superclass: MailDBFile
  subclasses:

I represent an index for the messages in a mail database. I acts like a dictionary that maps unique message ID's to IndexFileEntry objects.

The index file is read into memory in its entirety and kept there for the duration of a mail reading session. It should be stored back to disk at the end of the session, or after a major change, such as fetching new mail.

If necessary, it can be completely recreated by scanning the messages file!

instance methods
  dictionary access
  at:
at:ifAbsent:
at:put:
includesKey:
keys
keysCount
logStream
privateAt:put:
privateRemove:
remove:

  file operations
  delete
openOn:messageFile:readLogFlag:
readLogMessageFile:
rename:

  read-write
  readFrom:messageFile:
save
writeOn:

class methods
  instance creation
  openOn:messageFile:readLogFlag:

instance methods
  dictionary access top  
 

at:

Answer the IndexFileEntry for the message with the given ID.


 

at:ifAbsent:

Answer the IndexFileEntry for the message with the given ID. Evaluate the given block if there is no entry for the given ID.


 

at:put:

Associate the given IndexFileEntry with the given message ID.


 

includesKey:

Answer true if my message dictionary contains an entry for the message with the given ID.


 

keys

Answer a collection of message IDs for the messages in this IndexFile, sorted in ascending timestamp order. Because sorting is expensive, the sorted key list is cached.


 

keysCount


 

logStream


 

privateAt:put:

Associate the given IndexFileEntry with the given message ID.


 

privateRemove:

Remove the entry with the given ID from my Dictionary.


 

remove:

Remove the entry with the given ID from my Dictionary.


  file operations top  
 

delete

delete logfile


 

openOn:messageFile:readLogFlag:

Initialize myself from the file with the given name.


 

readLogMessageFile:


 

rename:

rename log file


  read-write top  
 

readFrom:messageFile:

Initialize myself from the given text stream. It is assumed that the
.index file was written in order of ascending message timestamps,
although this method is only less efficient, not incorrect, if this is not
the case.


 

save

Atomically save a representation of this object to its file. The old file is
renamed to '<oldname>.bak' before the new file is written. If the write
operation fails, the old file may be restored by renaming it. If it
succeeds, the .bak file is deleted.


 

writeOn:

Write my index entries to the given text stream in human-readable form.


class methods
  instance creation top  
 

openOn:messageFile:readLogFlag:

Answer a new instance of me for the given message file, backed by the
file with the given name.