114
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
MCFileBasedRepository subclass:#MCSMCacheRepository
|
|
4 |
instanceVariableNames:'smCache'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
592
|
7 |
category:'SCM-Monticello-Repositories'
|
114
|
8 |
!
|
|
9 |
|
|
10 |
MCSMCacheRepository comment:'I am a Monticello repository that reflects the caching of SqueakMap v2.
|
|
11 |
|
|
12 |
I refer write attempts to the default MCCacheRepository.'
|
|
13 |
!
|
|
14 |
|
|
15 |
|
|
16 |
!MCSMCacheRepository class methodsFor:'instance creation'!
|
|
17 |
|
|
18 |
description
|
|
19 |
^ 'SqueakMap Cache'
|
|
20 |
!
|
|
21 |
|
|
22 |
morphicConfigure
|
|
23 |
^self new
|
|
24 |
! !
|
|
25 |
|
|
26 |
!MCSMCacheRepository methodsFor:'accessing'!
|
|
27 |
|
|
28 |
allFileNames
|
|
29 |
^self allFullFileNames collect: [ :ea | self directory localNameFor: ea ]
|
|
30 |
!
|
|
31 |
|
|
32 |
allFullFileNames
|
|
33 |
| cachedPackages |
|
|
34 |
cachedPackages _ smCache map installedPackages select: [ :ea | ea isCached ].
|
|
35 |
^Array streamContents: [ :s |
|
|
36 |
cachedPackages do: [ :ea | | d |
|
|
37 |
d _ ea cacheDirectory.
|
|
38 |
(d fileNamesMatching: '*.mcz') do: [ :fn | s nextPut: (d fullNameFor: fn) ]]]
|
|
39 |
!
|
|
40 |
|
|
41 |
description
|
|
42 |
^ smCache directory pathName
|
|
43 |
!
|
|
44 |
|
|
45 |
directory
|
|
46 |
^ smCache directory
|
|
47 |
!
|
|
48 |
|
|
49 |
directory: aDirectory
|
|
50 |
!
|
|
51 |
|
|
52 |
fullNameFor: aFileName
|
|
53 |
^self allFullFileNames detect: [ :ffn | (self directory localNameFor: ffn) = aFileName ] ifNone: []
|
|
54 |
!
|
|
55 |
|
|
56 |
smCache
|
|
57 |
^smCache
|
|
58 |
!
|
|
59 |
|
|
60 |
smCache: aSMFileCache
|
|
61 |
| |
|
|
62 |
smCache := aSMFileCache.
|
|
63 |
self directory: aSMFileCache directory.
|
|
64 |
! !
|
|
65 |
|
|
66 |
!MCSMCacheRepository methodsFor:'comparing'!
|
|
67 |
|
|
68 |
hash
|
|
69 |
^ smCache hash
|
|
70 |
! !
|
|
71 |
|
|
72 |
!MCSMCacheRepository methodsFor:'file streaming'!
|
|
73 |
|
|
74 |
readStreamForFileNamed: aString do: aBlock
|
|
75 |
| file fileName |
|
|
76 |
fileName _ self fullNameFor: aString.
|
|
77 |
fileName ifNil: [
|
|
78 |
"assume that this will come from the cache."
|
|
79 |
^MCCacheRepository default readStreamForFileNamed: aString do: aBlock ].
|
|
80 |
file _ FileStream readOnlyFileNamed: fileName.
|
|
81 |
^[ aBlock value: file ] ensure: [ file close ].
|
|
82 |
!
|
|
83 |
|
|
84 |
writeStreamForFileNamed: aString replace: aBoolean do: aBlock
|
|
85 |
"Can't write into the SM cache, so..."
|
|
86 |
^MCCacheRepository default writeStreamForFileNamed: aString replace: aBoolean do: aBlock
|
|
87 |
! !
|
|
88 |
|
|
89 |
!MCSMCacheRepository methodsFor:'initialize-release'!
|
|
90 |
|
|
91 |
initialize
|
|
92 |
super initialize.
|
|
93 |
smCache _ SMSqueakMap default cache.
|
|
94 |
! !
|
|
95 |
|
|
96 |
!MCSMCacheRepository methodsFor:'testing'!
|
|
97 |
|
|
98 |
isValid
|
|
99 |
^smCache notNil and: [ self directory exists ]
|
|
100 |
! !
|
|
101 |
|
|
102 |
!MCSMCacheRepository class methodsFor:'documentation'!
|
|
103 |
|
|
104 |
version
|
592
|
105 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSMCacheRepository.st,v 1.2 2012-09-11 21:14:13 cg Exp $'
|
114
|
106 |
! !
|