author | Jan Vrany <jan.vrany@labware.com> |
Tue, 11 Jul 2023 12:13:27 +0100 | |
branch | jv |
changeset 1173 | e3dd2050492e |
parent 1121 | c5661215109c |
permissions | -rw-r--r-- |
1121
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
1 |
" |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
2 |
COPYRIGHT (c) 2020 LabWare |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
3 |
" |
114 | 4 |
"{ Package: 'stx:goodies/monticello' }" |
5 |
||
995
92bb466548a9
Removed test classes from stx:goodies/monticello - they're in tests sub package.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
592
diff
changeset
|
6 |
"{ NameSpace: Smalltalk }" |
92bb466548a9
Removed test classes from stx:goodies/monticello - they're in tests sub package.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
592
diff
changeset
|
7 |
|
114 | 8 |
MCFileBasedRepository subclass:#MCSMCacheRepository |
9 |
instanceVariableNames:'smCache' |
|
10 |
classVariableNames:'' |
|
11 |
poolDictionaries:'' |
|
592 | 12 |
category:'SCM-Monticello-Repositories' |
114 | 13 |
! |
14 |
||
15 |
MCSMCacheRepository comment:'I am a Monticello repository that reflects the caching of SqueakMap v2. |
|
16 |
||
17 |
I refer write attempts to the default MCCacheRepository.' |
|
18 |
! |
|
19 |
||
1121
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
20 |
!MCSMCacheRepository class methodsFor:'documentation'! |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
21 |
|
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
22 |
copyright |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
23 |
" |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
24 |
COPYRIGHT (c) 2020 LabWare |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
25 |
|
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
26 |
|
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
27 |
" |
c5661215109c
Tonel: various fixes here and there (part 2)
Jan Vrany <jan.vrany@labware.com>
parents:
995
diff
changeset
|
28 |
! ! |
114 | 29 |
|
30 |
!MCSMCacheRepository class methodsFor:'instance creation'! |
|
31 |
||
32 |
description |
|
33 |
^ 'SqueakMap Cache' |
|
34 |
! |
|
35 |
||
36 |
morphicConfigure |
|
37 |
^self new |
|
38 |
! ! |
|
39 |
||
40 |
!MCSMCacheRepository methodsFor:'accessing'! |
|
41 |
||
42 |
allFileNames |
|
43 |
^self allFullFileNames collect: [ :ea | self directory localNameFor: ea ] |
|
44 |
! |
|
45 |
||
46 |
allFullFileNames |
|
47 |
| cachedPackages | |
|
48 |
cachedPackages _ smCache map installedPackages select: [ :ea | ea isCached ]. |
|
49 |
^Array streamContents: [ :s | |
|
50 |
cachedPackages do: [ :ea | | d | |
|
51 |
d _ ea cacheDirectory. |
|
52 |
(d fileNamesMatching: '*.mcz') do: [ :fn | s nextPut: (d fullNameFor: fn) ]]] |
|
53 |
! |
|
54 |
||
55 |
description |
|
56 |
^ smCache directory pathName |
|
57 |
! |
|
58 |
||
59 |
directory |
|
60 |
^ smCache directory |
|
61 |
! |
|
62 |
||
63 |
directory: aDirectory |
|
64 |
! |
|
65 |
||
66 |
fullNameFor: aFileName |
|
67 |
^self allFullFileNames detect: [ :ffn | (self directory localNameFor: ffn) = aFileName ] ifNone: [] |
|
68 |
! |
|
69 |
||
70 |
smCache |
|
71 |
^smCache |
|
72 |
! |
|
73 |
||
74 |
smCache: aSMFileCache |
|
75 |
| | |
|
76 |
smCache := aSMFileCache. |
|
77 |
self directory: aSMFileCache directory. |
|
78 |
! ! |
|
79 |
||
80 |
!MCSMCacheRepository methodsFor:'comparing'! |
|
81 |
||
82 |
hash |
|
83 |
^ smCache hash |
|
84 |
! ! |
|
85 |
||
86 |
!MCSMCacheRepository methodsFor:'file streaming'! |
|
87 |
||
88 |
readStreamForFileNamed: aString do: aBlock |
|
89 |
| file fileName | |
|
90 |
fileName _ self fullNameFor: aString. |
|
91 |
fileName ifNil: [ |
|
92 |
"assume that this will come from the cache." |
|
93 |
^MCCacheRepository default readStreamForFileNamed: aString do: aBlock ]. |
|
94 |
file _ FileStream readOnlyFileNamed: fileName. |
|
95 |
^[ aBlock value: file ] ensure: [ file close ]. |
|
96 |
! |
|
97 |
||
98 |
writeStreamForFileNamed: aString replace: aBoolean do: aBlock |
|
99 |
"Can't write into the SM cache, so..." |
|
100 |
^MCCacheRepository default writeStreamForFileNamed: aString replace: aBoolean do: aBlock |
|
101 |
! ! |
|
102 |
||
103 |
!MCSMCacheRepository methodsFor:'initialize-release'! |
|
104 |
||
105 |
initialize |
|
106 |
super initialize. |
|
107 |
smCache _ SMSqueakMap default cache. |
|
108 |
! ! |
|
109 |
||
110 |
!MCSMCacheRepository methodsFor:'testing'! |
|
111 |
||
112 |
isValid |
|
113 |
^smCache notNil and: [ self directory exists ] |
|
114 |
! ! |
|
115 |
||
116 |
!MCSMCacheRepository class methodsFor:'documentation'! |
|
117 |
||
118 |
version |
|
592 | 119 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSMCacheRepository.st,v 1.2 2012-09-11 21:14:13 cg Exp $' |
114 | 120 |
! ! |
995
92bb466548a9
Removed test classes from stx:goodies/monticello - they're in tests sub package.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
592
diff
changeset
|
121 |