Skip to content

Commit

Permalink
Added transact: to methods affecting the contents
Browse files Browse the repository at this point in the history
  • Loading branch information
mtabacman committed Feb 8, 2024
1 parent 435530a commit 2d3a1ff
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions source/Sagan-GemStone/GemStoneRepository.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,20 @@ GemStoneRepository >> matchingCriteriaBuilder [
{ #category : 'private - management' }
GemStoneRepository >> purgeAfterCheckingInclusion: aDomainObject [

contents remove: aDomainObject ifAbsent: [
DataInconsistencyFound signal:
( '<1p> was expected to be found in the contents, but it was not.' expandMacrosWith:
aDomainObject )
].
^ aDomainObject
^ self transact: [
contents remove: aDomainObject ifAbsent: [
DataInconsistencyFound signal:
( '<1p> was expected to be found in the contents, but it was not.' expandMacrosWith:
aDomainObject )
].
aDomainObject
]
]

{ #category : 'management' }
GemStoneRepository >> purgeAllMatching: aCriteriaOrBlock [

contents := contents reject: ( self asMatchingCriteria: aCriteriaOrBlock )
self transact: [ contents := contents reject: ( self asMatchingCriteria: aCriteriaOrBlock ) ]
]

{ #category : 'private - accessing' }
Expand All @@ -120,8 +122,10 @@ GemStoneRepository >> saganGemStoneIndexOptions [
{ #category : 'private - management' }
GemStoneRepository >> storeAfterCheckingConflicts: aDomainObject [

contents add: aDomainObject.
^ aDomainObject
^ self transact: [
contents add: aDomainObject.
aDomainObject
]
]

{ #category : 'management' }
Expand All @@ -133,7 +137,7 @@ GemStoneRepository >> transact: aBlock [
{ #category : 'management' }
GemStoneRepository >> update: aMutableDomainObject executing: aBlock [

aBlock value: aMutableDomainObject
self transact: [ aBlock value: aMutableDomainObject ]
]

{ #category : 'private - management' }
Expand Down

0 comments on commit 2d3a1ff

Please sign in to comment.