Skip to content

Commit

Permalink
Merge pull request #624 from ApptiveGrid/add-version-to-index-page
Browse files Browse the repository at this point in the history
added version to index page
  • Loading branch information
noha authored Feb 16, 2024
2 parents bc9a348 + 2567604 commit d4d3544
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Soil-Core/SoilBTreeHeaderPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SoilBTreeHeaderPage >> printOn: aStream [
SoilBTreeHeaderPage >> readFrom: aStream [
dirty := false.
"we do not read the pageCode, that was done before"
version := aStream next.
self readLastTransactionFrom: aStream.
self readNextFrom: aStream.
keySize := (aStream next: 2) asInteger.
Expand Down
1 change: 1 addition & 0 deletions src/Soil-Core/SoilIndexItemsPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ SoilIndexItemsPage >> indexOfKey: anInteger [

{ #category : #initialization }
SoilIndexItemsPage >> initialize [
super initialize.
items := SortedCollection new
]

Expand Down
13 changes: 11 additions & 2 deletions src/Soil-Core/SoilIndexPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Class {
#superclass : #Object,
#instVars : [
'index',
'version',
'dirty',
'pageSize'
],
Expand Down Expand Up @@ -48,7 +49,7 @@ SoilIndexPage class >> readPageFrom: aStream keySize: keySize valueSize: valueSi

{ #category : #utilities }
SoilIndexPage >> headerSize [
^ 1 "pageCode"
^ 2 "pageCode, version"
]

{ #category : #accessing }
Expand All @@ -61,6 +62,12 @@ SoilIndexPage >> index: anInteger [
index := anInteger
]

{ #category : #initialization }
SoilIndexPage >> initialize [
super initialize.
version := 1
]

{ #category : #testing }
SoilIndexPage >> isDirty [
^ dirty
Expand Down Expand Up @@ -97,12 +104,14 @@ SoilIndexPage >> printOn: aStream [
SoilIndexPage >> readFrom: aStream [
dirty := false.
"we do not read the pageCode here as it was read already"
version := aStream next
]

{ #category : #writing }
SoilIndexPage >> writeHeaderOn: aStream [
aStream
nextPut: self class pageCode
nextPut: self class pageCode;
nextPut: version
]

{ #category : #writing }
Expand Down

0 comments on commit d4d3544

Please sign in to comment.