We got some problems with the cache logic recently. To the point we would like to add a UUID to the file name.
It needs a real look.

Stef

* I'm don't think it's used, but this might be a candidate:
cacheAllFileNamesDuring: aBlock
cacheFileNames == true ifTrue: [ ^ aBlock value ].
allFileNames := nil.
cacheFileNames := true.
<-- If this is a suspension point, if terminated, the file names would be static from the next call to allFileNames until the next time cacheAllFiles... is used -->
^ aBlock ensure: [
allFileNames := nil.
cacheFileNames := false]

If the need is guarding against arbitrary termination, not just errors in the block itself, I think it would have to be:

^[allFileNames := nil.
  cacheFileNames := true.
  aBlock value ] ensure:
[allFileNames := nil.
 cacheFileNames := false]


Of the actually called methods from includesVersionNamed:, I stopped checking after stumbling into, and spending too much time wondering why the code did what it did:

MCFileBasedRepository >> #readableFileNames
| all cached new emptyFilenamelength |
"<hyphenated-package-name>.<dotted.branch.tag>-<initials>.<count>.mcz"
emptyFilenamelength := 'P-i.c.mcz' size.
all := self allFileNames."from repository"
all := all reject: [ :each |  each size < emptyFilenamelength].
"first stupid way to filter first level broken files. Ideally we should
remove any files not following the naming pattern: PackageName-author.number[(branch)].mcz"
cached := self cachedFileNames."in memory"
new := all difference: cached.
^ (cached asArray, new)
select: [:ea | self canReadFileNamed: ea]

Removing cached entries from all entries, then iterating on the remaining + cached? That's an aweful lot of nonsense for the clearly essential capability to say you are able to read files that have recently been deleted from the file system...

Reply via email to