From e65b149e3b1484a1984cdfbedaac5bdd415e0e65 Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Tue, 13 Feb 2024 16:58:46 +0100 Subject: [PATCH] - categorize methods - simplify class tags - move visitor to it's own - start to add some class comments for the iterator --- src/Soil-Core/SoilBTreeIterator.class.st | 7 ++++ src/Soil-Core/SoilBackupVisitor.class.st | 2 +- .../SoilCompareVersionsVisitor.class.st | 2 +- src/Soil-Core/SoilFindRecordVisitor.class.st | 2 +- src/Soil-Core/SoilFindRecordsVisitor.class.st | 2 +- src/Soil-Core/SoilIndexNotFound.class.st | 2 +- src/Soil-Core/SoilInstanceVisitor.class.st | 2 +- .../SoilInvalidDatabaseVersion.class.st | 2 +- .../SoilJournalConsistencyVisitor.class.st | 2 +- src/Soil-Core/SoilObjectVisitor.class.st | 2 +- src/Soil-Core/SoilReferenceFinder.class.st | 2 +- src/Soil-Core/SoilReindexer.class.st | 2 +- src/Soil-Core/SoilSignal.class.st | 2 +- src/Soil-Core/SoilSkipListIterator.class.st | 8 +++++ src/Soil-Core/SoilTransaction.class.st | 34 +++++++++---------- .../SoilTransactionAlreadyAborted.class.st | 2 +- .../SoilTransactionalVisitor.class.st | 2 +- src/Soil-Core/SoilVisitor.class.st | 2 +- 18 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/Soil-Core/SoilBTreeIterator.class.st b/src/Soil-Core/SoilBTreeIterator.class.st index 1512cc18..d997d388 100644 --- a/src/Soil-Core/SoilBTreeIterator.class.st +++ b/src/Soil-Core/SoilBTreeIterator.class.st @@ -1,3 +1,10 @@ +" +The SoilBTreeIterator implements the SoilIndexIterator for the B+Tree index. + + +To get an iterator, call #newIterator on the index when used stand-alone, if the index is used for a SoilIndexedDictionary, +use the #newIterator there to setup the iterator correctly. +" Class { #name : #SoilBTreeIterator, #superclass : #SoilIndexIterator, diff --git a/src/Soil-Core/SoilBackupVisitor.class.st b/src/Soil-Core/SoilBackupVisitor.class.st index b4c8bc8c..152b6cde 100644 --- a/src/Soil-Core/SoilBackupVisitor.class.st +++ b/src/Soil-Core/SoilBackupVisitor.class.st @@ -7,7 +7,7 @@ Class { 'seen', 'toBeProcessed' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #api } diff --git a/src/Soil-Core/SoilCompareVersionsVisitor.class.st b/src/Soil-Core/SoilCompareVersionsVisitor.class.st index d38fefb3..067985ad 100644 --- a/src/Soil-Core/SoilCompareVersionsVisitor.class.st +++ b/src/Soil-Core/SoilCompareVersionsVisitor.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'version' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #initialization } diff --git a/src/Soil-Core/SoilFindRecordVisitor.class.st b/src/Soil-Core/SoilFindRecordVisitor.class.st index 87627840..aa00b840 100644 --- a/src/Soil-Core/SoilFindRecordVisitor.class.st +++ b/src/Soil-Core/SoilFindRecordVisitor.class.st @@ -5,7 +5,7 @@ Class { 'condition', 'object' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #api } diff --git a/src/Soil-Core/SoilFindRecordsVisitor.class.st b/src/Soil-Core/SoilFindRecordsVisitor.class.st index 62698e4b..b6248e7a 100644 --- a/src/Soil-Core/SoilFindRecordsVisitor.class.st +++ b/src/Soil-Core/SoilFindRecordsVisitor.class.st @@ -6,7 +6,7 @@ Class { 'records', 'numberOfRecords' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #api } diff --git a/src/Soil-Core/SoilIndexNotFound.class.st b/src/Soil-Core/SoilIndexNotFound.class.st index 32760fab..990f63c8 100644 --- a/src/Soil-Core/SoilIndexNotFound.class.st +++ b/src/Soil-Core/SoilIndexNotFound.class.st @@ -1,5 +1,5 @@ Class { #name : #SoilIndexNotFound, #superclass : #Error, - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Error' } diff --git a/src/Soil-Core/SoilInstanceVisitor.class.st b/src/Soil-Core/SoilInstanceVisitor.class.st index 223121e8..52b115bf 100644 --- a/src/Soil-Core/SoilInstanceVisitor.class.st +++ b/src/Soil-Core/SoilInstanceVisitor.class.st @@ -5,7 +5,7 @@ Class { 'soil', 'seen' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #initialization } diff --git a/src/Soil-Core/SoilInvalidDatabaseVersion.class.st b/src/Soil-Core/SoilInvalidDatabaseVersion.class.st index 269f7ac7..fd072284 100644 --- a/src/Soil-Core/SoilInvalidDatabaseVersion.class.st +++ b/src/Soil-Core/SoilInvalidDatabaseVersion.class.st @@ -1,5 +1,5 @@ Class { #name : #SoilInvalidDatabaseVersion, #superclass : #SoilError, - #category : #'Soil-Core-Files' + #category : #'Soil-Core-Error' } diff --git a/src/Soil-Core/SoilJournalConsistencyVisitor.class.st b/src/Soil-Core/SoilJournalConsistencyVisitor.class.st index 89560557..d59e6465 100644 --- a/src/Soil-Core/SoilJournalConsistencyVisitor.class.st +++ b/src/Soil-Core/SoilJournalConsistencyVisitor.class.st @@ -5,7 +5,7 @@ Class { 'databaseVersion', 'segments' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #initialization } diff --git a/src/Soil-Core/SoilObjectVisitor.class.st b/src/Soil-Core/SoilObjectVisitor.class.st index de1cc038..a2df48df 100644 --- a/src/Soil-Core/SoilObjectVisitor.class.st +++ b/src/Soil-Core/SoilObjectVisitor.class.st @@ -1,7 +1,7 @@ Class { #name : #SoilObjectVisitor, #superclass : #SoilTransactionalVisitor, - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #visiting } diff --git a/src/Soil-Core/SoilReferenceFinder.class.st b/src/Soil-Core/SoilReferenceFinder.class.st index 7fdce050..0f4ea3b6 100644 --- a/src/Soil-Core/SoilReferenceFinder.class.st +++ b/src/Soil-Core/SoilReferenceFinder.class.st @@ -5,7 +5,7 @@ Class { 'objectId', 'references' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #private } diff --git a/src/Soil-Core/SoilReindexer.class.st b/src/Soil-Core/SoilReindexer.class.st index d03ff4d9..cf73c47c 100644 --- a/src/Soil-Core/SoilReindexer.class.st +++ b/src/Soil-Core/SoilReindexer.class.st @@ -10,7 +10,7 @@ Class { 'newIndex', 'newIndexIterator' ], - #category : #'Soil-Core' + #category : #'Soil-Core-Index-Common' } { #category : #running } diff --git a/src/Soil-Core/SoilSignal.class.st b/src/Soil-Core/SoilSignal.class.st index 1a1d1c70..4bc05cf2 100644 --- a/src/Soil-Core/SoilSignal.class.st +++ b/src/Soil-Core/SoilSignal.class.st @@ -8,7 +8,7 @@ Class { #classVars : [ 'IdCounter' ], - #category : #'Soil-Core-Base' + #category : #'Soil-Core-Model' } { #category : #initialization } diff --git a/src/Soil-Core/SoilSkipListIterator.class.st b/src/Soil-Core/SoilSkipListIterator.class.st index 555d4f38..65952bbd 100644 --- a/src/Soil-Core/SoilSkipListIterator.class.st +++ b/src/Soil-Core/SoilSkipListIterator.class.st @@ -1,3 +1,11 @@ +" +The SoilBTreeIterator implements the SoilIndexIterator for the SkipList index. + +Try to avoid calling any method that is not implemented in SoilIndexIterator to be able to change easily to another index implementation. + +To get an iterator, call #newIterator on the index when used stand-alone, if the index is used for a SoilIndexedDictionary, +use the #newIterator there to setup the iterator correctly. +" Class { #name : #SoilSkipListIterator, #superclass : #SoilIndexIterator, diff --git a/src/Soil-Core/SoilTransaction.class.st b/src/Soil-Core/SoilTransaction.class.st index 01a95b13..e02159a6 100644 --- a/src/Soil-Core/SoilTransaction.class.st +++ b/src/Soil-Core/SoilTransaction.class.st @@ -44,7 +44,7 @@ SoilTransaction >> acquireLocksAndDetectWriteSkew [ idMap rehash. ] -{ #category : #adding } +{ #category : #api } SoilTransaction >> addClusterObject: anObject [ | objectId | objectMap at: anObject ifPresent: [ :record | ^ record objectId ]. @@ -124,7 +124,7 @@ SoilTransaction >> behaviorDescriptionFor: aClass [ ^ behaviorDescription ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> behaviorDescriptionWithObjectId: objectId andVersion: version [ idMap at: objectId @@ -140,7 +140,7 @@ SoilTransaction >> behaviorRegistry [ ^ soil behaviorRegistry ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> behaviorVersionsUpTo: aSOBehaviorDescription [ ^ self behaviorRegistry behaviorVersionsUpTo: aSOBehaviorDescription @@ -237,7 +237,7 @@ SoilTransaction >> checkpoint [ ] -{ #category : #'as yet unclassified' } +{ #category : #actions } SoilTransaction >> checkpointAndContinue [ self checkpoint; @@ -282,14 +282,14 @@ SoilTransaction >> dirtyObjects [ ^ idMap select: [ :each | each hasChanged ] thenCollect: #object ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> findObject: aBlock [ "scan all records in the database where the materialized object matches the condition in aBlock. Return the object of the record instead" ^ (self findRecord: [:record | aBlock value: record materializeObject ]) object ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> findRecord: aBlock [ "scan all connected records in the database until one matches the condition in aBlock" @@ -302,7 +302,7 @@ SoilTransaction >> findRecord: aBlock [ ifEmpty: [ nil ] ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> findRecords: aBlock [ "scan all connected records in the database until one matches the condition in aBlock" @@ -341,7 +341,7 @@ SoilTransaction >> initialize [ indexUpdatesToCommit := OrderedCollection new ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> initializeObjectId: anObjectId [ | segment assoc | anObjectId isInitialized ifTrue: [ SoilObjectIdAlreadyInitialized signal: 'object id is already initialized: ', anObjectId asString ]. @@ -382,7 +382,7 @@ SoilTransaction >> journal [ ^ journal ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> lockObjectId: aSOObjectId [ ^ self objectRepository lockObjectId: aSOObjectId for: self ] @@ -395,7 +395,7 @@ SoilTransaction >> makeNewVersion: classDescription [ add: record asNewClusterVersion ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> makeRoot: anObject [ | objectId | objectId := self addClusterObject: anObject theNonSoilProxy. @@ -415,7 +415,7 @@ SoilTransaction >> markDirty: anObject [ ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> materializeRecord: record [ ^ record transaction: self; @@ -472,7 +472,7 @@ SoilTransaction >> objectAt: anObjectId ifAbsent: aBlock [ ifAbsent: aBlock ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> objectIdOf: anObject [ ^ (objectMap at: anObject) objectId. @@ -483,12 +483,12 @@ SoilTransaction >> objectIndex [ ^ objectMap ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> objectRepository [ ^ soil objectRepository ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> objectWithId: objectId [ idMap ifNil: [ SoilTransactionAlreadyAborted signal: 'this transaction has already been aborted' ]. @@ -529,7 +529,7 @@ SoilTransaction >> printOn: aStream [ aStream << 'transaction read: ' << readVersion asString << ', write: ' << writeVersion asString ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> proxyForObjectId: aSOObjectId [ ^ aSOObjectId asSoilObjectProxy transaction: self @@ -545,7 +545,7 @@ SoilTransaction >> readVersion: anInteger [ readVersion := anInteger ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> recordWithId: objectId [ (objectId isInitialized) ifFalse: [ SoilIndexOutOfRange signal: 'object id ', objectId printString, ' needs index greater than zero' ]. ^ self objectRepository @@ -571,7 +571,7 @@ SoilTransaction >> registerRecord: record [ objectMap at: record object put: record ] -{ #category : #'as yet unclassified' } +{ #category : #api } SoilTransaction >> releaseLocks [ locks do: [ :lock | lock release ]. locks := OrderedCollection new diff --git a/src/Soil-Core/SoilTransactionAlreadyAborted.class.st b/src/Soil-Core/SoilTransactionAlreadyAborted.class.st index 0b533141..2584225b 100644 --- a/src/Soil-Core/SoilTransactionAlreadyAborted.class.st +++ b/src/Soil-Core/SoilTransactionAlreadyAborted.class.st @@ -1,5 +1,5 @@ Class { #name : #SoilTransactionAlreadyAborted, #superclass : #SoilError, - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Error' } diff --git a/src/Soil-Core/SoilTransactionalVisitor.class.st b/src/Soil-Core/SoilTransactionalVisitor.class.st index 3c69ee18..6d3c410d 100644 --- a/src/Soil-Core/SoilTransactionalVisitor.class.st +++ b/src/Soil-Core/SoilTransactionalVisitor.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'transaction' ], - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #visiting } diff --git a/src/Soil-Core/SoilVisitor.class.st b/src/Soil-Core/SoilVisitor.class.st index 38720c22..cd7c00c7 100644 --- a/src/Soil-Core/SoilVisitor.class.st +++ b/src/Soil-Core/SoilVisitor.class.st @@ -1,7 +1,7 @@ Class { #name : #SoilVisitor, #superclass : #Object, - #category : #'Soil-Core-Model' + #category : #'Soil-Core-Visitor' } { #category : #testing }