[Pkg] DeltaStreams: DeltaStreams-Model-gk.12.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Mon Jun 29 21:42:47 UTC 2009


A new version of DeltaStreams-Model was added to project DeltaStreams:
http://www.squeaksource.com/DeltaStreams/DeltaStreams-Model-gk.12.mcz

==================== Summary ====================

Name: DeltaStreams-Model-gk.12
Author: gk
Time: 29 June 2009, 11:42:40 pm
UUID: 39c23e4a-6fe4-4798-89ec-faeff00f75da
Ancestors: DeltaStreams-Model-gk.11

- DSAnnotation renamed to DSAnnotatedObject.
- Refactorings moving ICS code out.
- Properties and timeStamp moved to DSAnnotatedObject
- Name turned into a property.
- Removed some not implemented ivars in DSDelta.
- Simpler initialize in DSDelta


=============== Diff against DeltaStreams-Model-gk.11 ===============

Item was added:
+ ----- Method: DSAnnotatedObject>>name: (in category 'accessing') -----
+ name: aString
+ 
+ 	^self propertyAt: #name put: aString!

Item was added:
+ ----- Method: DSAnnotatedObject>>timeStamp (in category 'accessing') -----
+ timeStamp
+ 	^timeStamp!

Item was added:
+ ----- Method: DSAnnotatedObject>>name (in category 'accessing') -----
+ name
+ 
+ 	^self propertyAt: #name ifAbsent: ['<no name>']!

Item was added:
+ ----- Method: DSAnnotatedObject>>propertiesDo: (in category 'properties') -----
+ propertiesDo: aBlock
+ 	properties ifNil: [^ self].
+ 	properties keysAndValuesDo: aBlock!

Item was changed:
  DSCompositeChange subclass: #DSChangeSequence
  	instanceVariableNames: 'changes'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'DeltaStreams-Model-Composite'!
  
+ !DSChangeSequence commentStamp: 'gk 4/21/2009 23:44' prior: 0!
+ I am a base class for a sequence of changes. A DSDelta holds its changes in a DSChangeSequence.
+ 
+ The prime other example is the antiChange for DSClassRemovedChange - since the anti change should revert the effects it needs in this case both recreate the class, set its comment and add methods on both instance and class side. Thus the class DSClassAddedChange is a composite change that does all these changes in sequence.!
- !DSChangeSequence commentStamp: 'mtf 9/6/2007 21:22' prior: 0!
- I am a base class for a sequence of changes that logically belong together. The prime example is the antiChange for DSClassRemovedChange - since the anti change should revert the effects it needs in this case both recreate the class, set its comment and add methods on both instance and class side. Thus the class DSClassAddedChange is a composite change that does all these changes in sequence.!

Item was changed:
  ----- Method: DSDelta>>addChange: (in category 'change logging') -----
  addChange: aChange
  	"Within a Delta we give a change a monotonically increasing number
  	in order to be able to sort changes chronologically. The TimeStamp does
  	not work if changes are created very fast, they end up the same and sorting
  	becomes undefined. The change is copied if it already has a number,
  	in that case it is already in a different delta and we do not want to share."
  
  	| change |
  	change := aChange number ifNil: [aChange] ifNotNil: [aChange copy].
  	change number: self incrementChangeCounter.
+ 	self changes add: change.
- 	self compositeChange add: change.
  	self grouper ifNotNil: [self grouper add: change].
  	self changed: #changeList.
  	^ change!

Item was added:
+ ----- Method: DSChange>>isSequence (in category 'testing') -----
+ isSequence
+ 	^false!

Item was added:
+ Object subclass: #DSAnnotatedObject
+ 	instanceVariableNames: 'timeStamp properties'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'DeltaStreams-Model-Base'!
+ 
+ !DSAnnotatedObject commentStamp: 'gk 3/18/2009 16:06' prior: 0!
+ An abstract superclass for anything that can have named properties and a creation timeStamp.
+ The properties Dictionary is lazily initialized.!

Item was added:
+ ----- Method: DSChangeSequence>>isSequence (in category 'testing') -----
+ isSequence
+ 	^true!

Item was changed:
  ----- Method: DSDelta>>changes (in category 'accessing') -----
  changes
+ 	^ changes!
- 	^ self compositeChange changes!

Item was changed:
+ ----- Method: DSDelta>>uuid: (in category 'private') -----
- ----- Method: DSDelta>>uuid: (in category 'initialize-release') -----
  uuid: aUUID
+ 	uuid := aUUID!
- 	super initialize.
- 	uuid := aUUID.
- 	changeCounter := 0.
- 	notRevertable := false
- 	!

Item was changed:
  DSChange subclass: #DSCompositeChange
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'DeltaStreams-Model-Composite'!
  
+ !DSCompositeChange commentStamp: 'gk 4/21/2009 23:43' prior: 0!
+ A composite change is an abstract base class for changes that consists of other changes. It is not necessarily ordered. My primary subclass is DSChangeSequence, which stores a sequence of changes.!
- !DSCompositeChange commentStamp: 'mtf 9/6/2007 17:43' prior: 0!
- A composite change is an abstract base class for changes that logically belong together. It is not necessarily ordered. My primary subclass is DSChangeSequence, which stores a sequence of changes!

Item was changed:
+ DSAnnotatedObject subclass: #DSChange
+ 	instanceVariableNames: 'number'
- DSAnnotation subclass: #DSChange
- 	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'DeltaStreams-Model-Base'!
  
+ !DSChange commentStamp: 'gk 4/21/2009 23:41' prior: 0!
+ An abstract super class for all changes that a DSDelta holds. A DSChange object should only hold "simple data" and not refer to the classes themselves. This makes them easy to construct, manipulate and serialize without affecting (or need) the real classes.
+ 
+ A DSChange has a number to be able to maintain ordering - timestamping is not enough when things are going fast. A DSChange should ONLY exist in one given Delta at time, we verify this by checking that number is indeed nil when the change is added to the DSDelta.!
- !DSChange commentStamp: '<historical>' prior: 0!
- An abstract super class for all fine granular changes that a DSDelta holds. A DSChange object should only hold "simple data" and not refer to the classes themselves. This makes them easy to construct, manipulate and serialize without affecting (or need) the real classes.!

Item was changed:
  ----- Method: DSVisitor>>applyDelta: (in category 'composite changes') -----
  applyDelta: aDelta
  	"Treat like a composite change by default."
  	
+ 	^ self applyCompositeChange: aDelta changes!
- 	^ self applyCompositeChange: aDelta compositeChange!

Item was added:
+ ----- Method: DSAnnotatedObject>>propertyAt:put: (in category 'properties') -----
+ propertyAt: aSymbol put: value
+ 
+ 	properties ifNil: [properties := Dictionary new].
+ 	^ properties at: aSymbol put: value!

Item was changed:
  ----- Method: DSChange>>number (in category 'accessing') -----
  number
  	^number!

Item was changed:
  ----- Method: DSChange>><= (in category 'comparing') -----
+ <= other
+ 	"Sort by number per default, this represents order of addition."
- <= aChange
- 	"Sort by number per default."
  
+ 	^number <= other number!
- 	^number <= aChange number!

Item was added:
+ ----- Method: DSAnnotatedObject>>properties (in category 'accessing') -----
+ properties
+ 	^properties!

Item was added:
+ ----- Method: DSAnnotatedObject>>initialize (in category 'initialize-release') -----
+ initialize
+ 
+ 	timeStamp := TimeStamp now!

Item was added:
+ ----- Method: DSChange>>= (in category 'comparing') -----
+ = aChange
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: DSAnnotatedObject>>propertyAt:ifAbsent: (in category 'properties') -----
+ propertyAt: key ifAbsent: aBlock
+ 
+ 	^ properties
+ 		ifNil: aBlock
+ 		ifNotNil: [properties at: key ifAbsent: aBlock]!

Item was added:
+ ----- Method: DSAnnotatedObject>>properties: (in category 'accessing') -----
+ properties: aDictionary
+ 	properties := aDictionary!

Item was added:
+ ----- Method: DSChangeSequence>>= (in category 'comparing') -----
+ = aChange
+ 	"We are equal if we have the same changes in the same order."
+ 
+ 	^aChange isSequence and: [
+ 		self changes = aChange changes]
+ !

Item was added:
+ ----- Method: DSAnnotatedObject>>propertyAt: (in category 'properties') -----
+ propertyAt: key
+ 
+ 	^self propertyAt: key ifAbsent: [nil]!

Item was changed:
  ----- Method: DSDelta>>isRevertable (in category 'testing') -----
  isRevertable
  	"It is revertable if all changes are per definition revertable
+ 	and this Delta is flagged as revertable."
- 	and this Delta is not flagged as notRevertable."
  
+ 	^(self propertyAt: #revertable ifAbsent: [true]) and: [self changesRevertable]!
- 	^notRevertable not and: [self changesRevertable]!

Item was added:
+ ----- Method: DSAnnotatedObject>>propertyAt:ifAbsentPut: (in category 'properties') -----
+ propertyAt: key ifAbsentPut: aBlock
+ 
+ 	^ self propertyAt: key ifAbsent: [
+ 		self propertyAt: key put: aBlock value]!

Item was changed:
  ----- Method: DSDelta>>normalize (in category 'applying') -----
  normalize
  	"Modify changes so that they are compacted into the minimal form
  	still producing the equivalent end result. In other words - remove redundancy."
  
+ 	changes ifNotNil: [
+ 		changes moveClassNameChanges; removeShadows; mergeChanges]!
- 	compositeChange ifNotNil: [
- 		compositeChange moveClassNameChanges; removeShadows; mergeChanges]!

Item was changed:
  ----- Method: DSChange>>number: (in category 'accessing') -----
  number: aNumber
  	number := aNumber!

Item was changed:
  ----- Method: DSDelta>>initialize (in category 'initialize-release') -----
  initialize
+ 	super initialize.
+ 	changes := DSChangeSequence new.
+ 	changeCounter := 0.
+ 	uuid := UUID new!
- 	self uuid: UUID new!

Item was added:
+ ----- Method: DSAnnotatedObject>>timeStamp: (in category 'accessing') -----
+ timeStamp: aTimeStamp
+ 	timeStamp := aTimeStamp!

Item was changed:
+ DSAnnotatedObject subclass: #DSDelta
+ 	instanceVariableNames: 'changes uuid changeCounter'
- DSChange subclass: #DSDelta
- 	instanceVariableNames: 'compositeChange uuid test notRevertable changeCounter'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'DeltaStreams-Model-Base'!
  
+ !DSDelta commentStamp: 'gk 6/29/2009 21:54' prior: 0!
+ A Delta is much like a ChangeSet but improved and simplified. It can capture changes like a ChangeSet does (see #event:), but unlike ChangeSets multiple Deltas can be logging changes at the same time. A Delta maintains a chronologically ordered collection of change objects that is a true log unlike a ChangeSet which tries to normalize changes on the fly and does not maintain an order.
+ 
+ Also - each change object carries more information than a record in a ChangeSet does - and they know how to produce their anti change which in turn gives a Delta the ability to produce its own anti Delta. Such an anti Delta can be used to revert a Delta.
- !DSDelta commentStamp: '<historical>' prior: 0!
- A Delta is much like a ChangeSet but improved and simplified. It captures changes much like a ChangeSet does (see #event:), but unlike ChangeSet multiple Deltas can be logging changes at the same time. A DeltaSet also maintains a chronologically ordered collection of change objects that is a true log unlike a ChangeSet which tries to normalize on the fly and does not maintain an order.
  
+ Instance variables:
+ 
+ changes - an instance of DSChangeSequence.
+ uuid - created when I am first instantiated, never changed.
+ changeCounter - a counter to ensure strict sorting of changes, timestamps are not sufficient.
+ 
+ Standard properties:
+ 
+ #revertable - if missing we presume true. Can be used to explicitly flag a Delta as revertable/not revertable.
+ !
- Each change object carries more information than a record in a ChangeSet does - and they know how to produce their anti change which in turn gives a DSDelta the ability to produce its own anti Delta. Such an anti Delta can be used to revert a Delta.!

Item was added:
+ ----- Method: DSDelta>>= (in category 'comparing') -----
+ = aDelta
+ 	"Two deltas are considered equal if they contain the same change sequence."
+ 
+ 	^changes = aDelta changes	!

Item was removed:
- ----- Method: DSMethodChange>>entryWriters (in category 'objects from disk') -----
- entryWriters
- 	^ Array with: (ICSMethodEntryWriter new
- 		writeMethodEntryFor: self class
- 		className: className
- 		meta: meta
- 		selector: selector
- 		source: source
- 		stamp: stamp
- 		protocol: protocol
- 		properties: self propertiesToPersist
- 	; yourself)!

Item was removed:
- ----- Method: DSChange>>persistantPropertyNames (in category 'objects from disk') -----
- persistantPropertyNames
- 	^ #(name)!

Item was removed:
- ----- Method: DSChange>>name (in category 'accessing') -----
- name
- 
- 	^self propertyAt: #name ifAbsent: ['<no name>']!

Item was removed:
- ----- Method: DSClassTypeChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldType put: self oldType;
- 		yourself!

Item was removed:
- ----- Method: DSDelta>>compositeChange (in category 'accessing') -----
- compositeChange
- 	^ compositeChange ifNil: [compositeChange := DSChangeSequence new]!

Item was removed:
- ----- Method: DSClassCategoryChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldCategory put: self oldCategory;
- 		yourself!

Item was removed:
- Object subclass: #DSAnnotation
- 	instanceVariableNames: 'timeStamp number properties'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'DeltaStreams-Model-Base'!
- 
- !DSAnnotation commentStamp: '<historical>' prior: 0!
- An abstract superclass for anything that can be stored in a delta stream!

Item was removed:
- ----- Method: DSDelta>>isMaybeRevertable (in category 'testing') -----
- isMaybeRevertable
- 	"It is maybe revertable if all changes are per definition revertable
- 	or marked by the developer as being revertable and this Delta
- 	is not flagged as notRevertable."
- 
- 	^notRevertable not and: [self changesMaybeRevertable]!

Item was removed:
- ----- Method: DSChange>>propertyAt:ifAbsent: (in category 'accessing properties') -----
- propertyAt: key ifAbsent: aBlock
- 
- 	^ properties
- 		ifNil: aBlock
- 		ifNotNil: [properties at: key ifAbsent: aBlock]!

Item was removed:
- ----- Method: DSClassNameChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldName put: self oldName;
- 		yourself!

Item was removed:
- ----- Method: DSChange>>entryWriters (in category 'objects from disk') -----
- entryWriters
- 	^ #()!

Item was removed:
- ----- Method: DSChange>>timeStamp (in category 'accessing') -----
- timeStamp
- 	^timeStamp!

Item was removed:
- ----- Method: DSChange>>propertiesDo: (in category 'accessing properties') -----
- propertiesDo: aBlock
- 	properties ifNil: [^ self].
- 	properties keysAndValuesDo: aBlock!

Item was removed:
- ----- Method: DSChange>>propertyAt:ifAbsentPut: (in category 'accessing properties') -----
- propertyAt: key ifAbsentPut: aBlock
- 
- 	^ self propertyAt: key ifAbsent: [
- 		self propertyAt: key put: aBlock value]!

Item was removed:
- ----- Method: DSDelta>>changesMaybeRevertable (in category 'testing') -----
- changesMaybeRevertable
- 	"Are all changes per definition revertable
- 	or marked by the developer as being revertable?"
- 
- 	^self changes allSatisfy: [:change | change isMaybeRevertable]!

Item was removed:
- ----- Method: DSClassChange>>entryWriters (in category 'objects from disk') -----
- entryWriters
- 	^ Array with: (ICSClassEntryWriter new
- 		writeClassEntryFor: self class
- 		className: className
- 		type: type
- 		superclass: superclassName
- 		instanceVariables: instVarNames
- 		classVariables: classVarNames
- 		sharedPools: self poolDictionaryNames
- 		category: category
- 		classInstanceVariables: classInstVarNames
- 		comment: comment		
- 		stamp: stamp
- 		properties: self propertiesToPersist
- 	; yourself)!

Item was removed:
- ----- Method: DSChange>>name: (in category 'accessing') -----
- name: aString
- 
- 	^self propertyAt: #name put: aString!

Item was removed:
- ----- Method: DSMethodSourceChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldSource put: self oldSource;
- 		yourself!

Item was removed:
- ----- Method: DSChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	"Answer a dictionary of properties that should be saved to disk, in string form"
- 
- 	| answer |
- 	answer := Dictionary new.
- 	self persistantPropertyNames do: [:key |
- 		(self propertyAt: key) ifNotNilDo: [:value |
- 			answer at: key put: value asString]].
- 	timeStamp ifNotNil: [answer at: #timeStamp put: timeStamp asString].
- 	^ answer!

Item was removed:
- ----- Method: DSClassSuperclassChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldSuperclassName put: self oldSuperclassName;
- 		yourself!

Item was removed:
- ----- Method: DSChange>>initialize (in category 'initialize-release') -----
- initialize
- 
- 	timeStamp := TimeStamp now!

Item was removed:
- ----- Method: DSMethodProtocolChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldProtocol put: self oldProtocol;
- 		yourself!

Item was removed:
- ----- Method: DSCompositeChange>>entryWriters (in category 'objects from disk') -----
- entryWriters
- 
- 	| all |
- 	self error: 'This is not so easy, we need an entryWriter for myself too!!'.
- 	all := OrderedCollection new.
- 	self do: [:ch | all addAll: ch entryWriters].
- 	^all!

Item was removed:
- ----- Method: DSChange>>propertyAt:put: (in category 'accessing properties') -----
- propertyAt: aSymbol put: value
- 
- 	properties ifNil: [properties := Dictionary new].
- 	^ properties at: aSymbol put: value!

Item was removed:
- ----- Method: DSClassCommentChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldComment put: self oldComment;
- 		at: #oldStamp put: self oldStamp;
- 		yourself!

Item was removed:
- ----- Method: DSChange>>propertyAt: (in category 'accessing properties') -----
- propertyAt: key
- 
- 	^self propertyAt: key ifAbsent: [nil]!

Item was removed:
- ----- Method: DSDelta class>>uuid: (in category 'utilities') -----
- uuid: aUUID
- 	^ self basicNew uuid: aUUID; yourself!

Item was removed:
- ----- Method: DSVarsChange>>propertiesToPersist (in category 'objects from disk') -----
- propertiesToPersist
- 	^ super propertiesToPersist
- 		at: #oldVars put: self oldVars asSpaceString;
- 		yourself!



More information about the Packages mailing list