Skip to content

Index: refactor #cleanRemoved to pass the index #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Soil-Core/SoilBTreeHeaderPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ SoilBTreeHeaderPage class >> pageCode [
^ 3
]

{ #category : #testing }
SoilBTreeHeaderPage >> canBeRemoved [
^ false
]

{ #category : #utilities }
SoilBTreeHeaderPage >> decreaseSize [
size := size - 1.
Expand Down
7 changes: 7 additions & 0 deletions src/Soil-Core/SoilBTreePage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ SoilBTreePage >> bTreeAssertion [
items isEmpty ifFalse: [ self assert: self hasUnderflow not ]
]

{ #category : #removing }
SoilBTreePage >> cleanRemovedIn: index [
(items select: [ :each | each value isRemoved ])
do: [:removedItem | self remove: removedItem key for: index].
needWrite := true
]

{ #category : #private }
SoilBTreePage >> find: aKey with: aBTree [
^ self subclassResponsibility
Expand Down
2 changes: 1 addition & 1 deletion src/Soil-Core/SoilBTreeRootPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SoilBTreeRootPage >> initialize [
self addItem: 0 -> 1 "headPage id"
]

{ #category : #searching }
{ #category : #adding }
SoilBTreeRootPage >> insertItem: item for: iterator [
| foundItem return newIndexPage1 newIndexPage2 |

Expand Down
5 changes: 5 additions & 0 deletions src/Soil-Core/SoilIndex.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ SoilIndex >> basicAt: key put: anObject [
put: anObject
]

{ #category : #removing }
SoilIndex >> cleanRemoved: aPage [
aPage cleanRemovedIn: self
]

{ #category : #'as yet unclassified' }
SoilIndex >> cleanUpToVersion: aNumberOrNil [
SoilIndexCleaner new
Expand Down
5 changes: 3 additions & 2 deletions src/Soil-Core/SoilIndexCleaner.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ SoilIndexCleaner >> cleanPage: page [
addDirtyPage: (index recyclePage: page) ]
ifFalse: [
"just clean the page"
page cleanRemoved.
index addDirtyPage: page ]
index
cleanRemoved: page;
addDirtyPage: page ]
]

{ #category : #accessing }
Expand Down
7 changes: 3 additions & 4 deletions src/Soil-Core/SoilIndexItemsPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ SoilIndexItemsPage >> canBeRemoved [
^ self presentItemCount isZero
]

{ #category : #running }
SoilIndexItemsPage >> cleanRemoved [
items removeAllSuchThat: [ :each | each value isRemoved ].
needWrite := true
{ #category : #removing }
SoilIndexItemsPage >> cleanRemovedIn: index [
self subclassResponsibility
]

{ #category : #accessing }
Expand Down
12 changes: 12 additions & 0 deletions src/Soil-Core/SoilSkipListPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ SoilSkipListPage >> biggestKey [
ifFalse: [ self lastKey ]
]

{ #category : #removing }
SoilSkipListPage >> cleanRemoved [
items removeAllSuchThat: [ :each | each value isRemoved ].
needWrite := true
]

{ #category : #removing }
SoilSkipListPage >> cleanRemovedIn: index [
"index not needed for the SkipList"
self cleanRemoved
]

{ #category : #initialization }
SoilSkipListPage >> initialize [
super initialize.
Expand Down
Loading