Skip to content

#compact for Btree: push up to SoilIndex #894

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
6 changes: 0 additions & 6 deletions src/Soil-Core/SoilBTree.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ SoilBTree >> keySize: anInteger [
keySize := anInteger
]

{ #category : #reindexing }
SoilBTree >> newPluggableRewriter [
^ SoilPluggableIndexRewriter new
index: self
]

{ #category : #accessing }
SoilBTree >> path [

Expand Down
23 changes: 23 additions & 0 deletions src/Soil-Core/SoilIndex.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ SoilIndex >> close [
store := nil
]

{ #category : #private }
SoilIndex >> compact [
"Rewrite index file without removed items"
self rewriteUsing: [ :item | item ]
]

{ #category : #utilities }
SoilIndex >> decreaseSize [
self headerPage decreaseSize.
Expand Down Expand Up @@ -263,6 +269,12 @@ SoilIndex >> newPage [
^ self subclassResponsibility
]

{ #category : #reindexing }
SoilIndex >> newPluggableRewriter [
^ SoilPluggableIndexRewriter new
index: self
]

{ #category : #accessing }
SoilIndex >> pageAt: anInteger [
^ self store pageAt: anInteger
Expand Down Expand Up @@ -348,6 +360,17 @@ SoilIndex >> reverseDo: aBlock [
self newIterator reverseDo: aBlock
]

{ #category : #initialization }
SoilIndex >> rewriteUsing: aBlock [
"write new index file and add all items. Use aBlock to
enable converting items"
self newPluggableRewriter
indexBlock: [ :idx | idx ];
itemBlock: aBlock;
cleanRemoved;
run
]

{ #category : #accessing }
SoilIndex >> size [
"We iterate over all elements to get the size. Slow!"
Expand Down
10 changes: 10 additions & 0 deletions src/Soil-Core/SoilIndexedDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ SoilIndexedDictionary >> basicAt: aString ifAbsent: aBlock [
^ self newIterator at: aString ifAbsent: aBlock
]

{ #category : #rewriting }
SoilIndexedDictionary >> compact [
index wrapped compact
]

{ #category : #initialization }
SoilIndexedDictionary >> createIndex [
^ self subclassResponsibility
Expand Down Expand Up @@ -252,6 +257,11 @@ SoilIndexedDictionary >> reverseDo: aBlock [
aBlock value: objectId ]
]

{ #category : #rewriting }
SoilIndexedDictionary >> rewriteUsing: aBlock [
index wrapped rewriteUsing: aBlock
]

{ #category : #accessing }
SoilIndexedDictionary >> second [
^ self newIterator first; next
Expand Down
24 changes: 0 additions & 24 deletions src/Soil-Core/SoilSkipList.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ SoilSkipList >> close [
keySize := nil
]

{ #category : #private }
SoilSkipList >> compact [
"Rewrite index file without removed items"
self rewriteUsing: [ :item | item ]
]

{ #category : #deleting }
SoilSkipList >> destroy [
path ensureDelete
Expand Down Expand Up @@ -92,12 +86,6 @@ SoilSkipList >> newHeaderPage [
pageSize: self pageSize
]

{ #category : #reindexing }
SoilSkipList >> newPluggableRewriter [
^ SoilPluggableIndexRewriter new
index: self
]

{ #category : #'opening/closing' }
SoilSkipList >> open [
self isOpen ifTrue: [ self error: 'Index already open' ].
Expand All @@ -116,18 +104,6 @@ SoilSkipList >> path: aStringOrFileReference [
path := aStringOrFileReference asFileReference
]

{ #category : #initialization }
SoilSkipList >> rewriteUsing: aBlock [
"write new index file and add all items. Use aBlock to
enable converting items"
SoilPluggableIndexRewriter new
index: self;
indexBlock: [ :idx | idx ];
itemBlock: aBlock;
cleanRemoved;
run
]

{ #category : #converting }
SoilSkipList >> thePersistentInstance [
^ self
Expand Down
10 changes: 0 additions & 10 deletions src/Soil-Core/SoilSkipListDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,10 @@ Class {
#category : #'Soil-Core-Index-SkipList'
}

{ #category : #rewriting }
SoilSkipListDictionary >> compact [
index wrapped compact
]

{ #category : #initialization }
SoilSkipListDictionary >> createIndex [
^ SoilSkipList new
initializeHeaderPage;
valueSize: 8;
yourself
]

{ #category : #rewriting }
SoilSkipListDictionary >> rewriteUsing: aBlock [
index wrapped rewriteUsing: aBlock
]
Loading