From 37d88e15cbe210185641a70e79f7f16982293e0d Mon Sep 17 00:00:00 2001 From: Norbert Hartl Date: Fri, 16 Feb 2024 15:10:40 +0100 Subject: [PATCH] fixed tests for BTree. Fixed skiplist headerSize --- src/Soil-Core/SoilBasicBTree.class.st | 5 +++++ src/Soil-Core/SoilSkipListHeaderPage.class.st | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Soil-Core/SoilBasicBTree.class.st b/src/Soil-Core/SoilBasicBTree.class.st index f19d3ec0..a89289af 100644 --- a/src/Soil-Core/SoilBasicBTree.class.st +++ b/src/Soil-Core/SoilBasicBTree.class.st @@ -22,6 +22,11 @@ SoilBasicBTree >> flush [ self store flush ] +{ #category : #testing } +SoilBasicBTree >> hasHeaderPage [ + ^ store hasHeaderPage +] + { #category : #initialization } SoilBasicBTree >> initializeFilesystem [ self store initializeFilesystem diff --git a/src/Soil-Core/SoilSkipListHeaderPage.class.st b/src/Soil-Core/SoilSkipListHeaderPage.class.st index 23da34f5..8f7c7a1b 100644 --- a/src/Soil-Core/SoilSkipListHeaderPage.class.st +++ b/src/Soil-Core/SoilSkipListHeaderPage.class.st @@ -17,12 +17,19 @@ SoilSkipListHeaderPage class >> pageCode [ { #category : #utilities } SoilSkipListHeaderPage >> headerSize [ ^ super headerSize - + 10 "keySize, valueSize, maxLevel, lastPageIndex" + + 14 "keySize(2), valueSize(2), maxLevel(2), lastPageIndex(4), lastFreePageIndex(4)" + 1 "level" + (self level * self rightSize) + 2 "items size" ] +{ #category : #initialization } +SoilSkipListHeaderPage >> initialize [ + super initialize. + lastPageIndex := 1. + lastFreePageIndex := 0 +] + { #category : #accessing } SoilSkipListHeaderPage >> keySize: anInteger [ "as long as no items have been added the key size can be changed"