On Sat, May 12, 2012 at 3:03 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
I'm porting some apps that were using simple image-based persistence (ReferenceStream) from 1.3 to 1.4.
The first thing that I ran into was FS class name changes (e.g. FSReference -> FileReference). Since the class wasn't present, I got an errorKeyNotFound [1]. Naively tried:
Smalltalk globals at: #FSReference put: FileReference; at: #FSFilesystem put: FileSystem; at: #FSAbsolutePath put: AbsolutePath; at: #FSUnixStore put: UnixStore.
But got "primitive #primGetPosition: in MultiByteFileStream failed" from ReferenceStream>>next
I have a few ideas, but has anyone gone successfully through this type of process before? What's my best bet? I've been following Fuel and STON (which is quite nice for parsing json from REST APIs b.t.w.), but I'm not clear if either would be helpful here.
Sorry, I don't have ideas of how to solve that. However, I can only say that Fuel *does* suppor that type of problem (if I understood the problem correctly). The following test demonstrates an example: FLMigrationTest >> testClassRename | pointClass aPoint resultPoint pointClassName | pointClass := self newClassWithInstanceVariableNames: 'x y'. pointClassName := pointClass name. aPoint := pointClass new. aPoint instVarNamed: 'x' put: 7. aPoint instVarNamed: 'y' put: 11. self serialize: aPoint. pointClass renameSilently: (pointClassName, 'Renamed') asSymbol. self materializer migrateClassNamed: pointClassName toClass: pointClass. resultPoint := self materialized. self assert: (resultPoint instVarNamed: 'x') = 7. self assert: (resultPoint instVarNamed: 'y') = 11.
What do you suggest?
Thanks, Sean
[1] Stack trace (heavily snipped) SystemDictionary(Dictionary)>>errorKeyNotFound: Receiver: a SystemDictionary(lots of globals) Arguments and temporary variables: aKey: #FSReference Receiver's instance variables: tally: 2920 array: an Array(#MemoryHandle->MemoryHandle nil nil #BlockClosuresTestCase->Blo...etc... cachedClassNames: nil cachedNonClassNames: nil
...
ReferenceStream(DataStream)>>readInstance Receiver: a ReferenceStream Arguments and temporary variables: instSize: 2 aSymbol: #FSReference refPosn: 50 anObject: nil newClass: nil Receiver's instance variables: byteStream: MultiByteFileStream: '/Volumes/Sean''s Universe/sean/.jenkins/jobs/...etc... topCall: nil basePos: 0 references: an IdentityDictionary() objects: an IdentityDictionary(0->#(nil) 5->a Resources 10->#Resources 21->an O...etc... currentReference: 55 fwdRefEnds: an IdentityDictionary() blockers: an IdentityDictionary() skipping: an IdentitySet()
-- View this message in context: http://forum.world.st/Moving-data-into-new-package-image-version-tp4628820.h... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Mariano http://marianopeck.wordpress.com