Skip to content

Commit 8646987

Browse files
committed
Move internal modules to an private sub-library
1 parent ea147aa commit 8646987

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+54
-16
lines changed

lsm-tree/bench-unions/Bench/Unions.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ import qualified Text.Read as Read
113113

114114
import Database.LSMTree.Extras (groupsOfN)
115115
import qualified Database.LSMTree.Extras.Random as Random
116-
import Database.LSMTree.Internal.ByteString (byteArrayToSBS)
117116

118117
import qualified Database.LSMTree.Simple as LSM
119118

@@ -177,6 +176,14 @@ makeKey seed =
177176
of (P.PrimArray ba :: P.PrimArray Word64) ->
178177
byteArrayToSBS (P.ByteArray ba)
179178

179+
-- | \( O(1) \) conversion.
180+
byteArrayToSBS :: P.ByteArray -> BS.ShortByteString
181+
#if MIN_VERSION_bytestring(0,12,0)
182+
byteArrayToSBS ba = BS.ShortByteString ba
183+
#else
184+
byteArrayToSBS (P.ByteArray ba) = BS.SBS ba
185+
#endif
186+
180187
-- We use constant value. This shouldn't affect anything.
181188
theValue :: V
182189
theValue = BS.replicate 60 120 -- 'x'

lsm-tree/bench/macro/utxo-bench.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ import Text.Printf (printf)
7171
import Text.Show.Pretty
7272

7373
import Database.LSMTree.Extras (groupsOfN)
74-
import Database.LSMTree.Internal.ByteString (byteArrayToSBS)
7574

7675
-- We should be able to write this benchmark
7776
-- using only use public lsm-tree interface
@@ -128,6 +127,14 @@ makeKey seed =
128127
of (P.PrimArray ba :: P.PrimArray Word64) ->
129128
byteArrayToSBS (P.ByteArray ba)
130129

130+
-- | \( O(1) \) conversion.
131+
byteArrayToSBS :: P.ByteArray -> BS.ShortByteString
132+
#if MIN_VERSION_bytestring(0,12,0)
133+
byteArrayToSBS ba = BS.ShortByteString ba
134+
#else
135+
byteArrayToSBS (P.ByteArray ba) = BS.SBS ba
136+
#endif
137+
131138
-- We use constant value. This shouldn't affect anything.
132139
theValue :: V
133140
theValue = BS.replicate 60 120 -- 'x'

lsm-tree/lsm-tree.cabal

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,28 @@ library
537537
hs-source-dirs: src
538538
exposed-modules:
539539
Database.LSMTree
540+
Database.LSMTree.Simple
541+
542+
build-depends:
543+
, base >=4.16 && <4.22
544+
, blockio ^>=0.1
545+
, contra-tracer ^>=0.1 || ^>=0.2
546+
, deepseq ^>=1.4 || ^>=1.5
547+
, fs-api ^>=0.4
548+
, io-classes ^>=1.6 || ^>=1.7 || ^>=1.8.0.1
549+
, io-classes:strict-mvar
550+
, lsm-tree:control
551+
, lsm-tree:core
552+
, primitive ^>=0.9
553+
, random ^>=1.0 || ^>=1.1 || ^>=1.2 || ^>=1.3
554+
, text ^>=2.1.1
555+
, vector ^>=0.13
556+
557+
library core
558+
import: language, warnings, wno-x-partial
559+
visibility: private
560+
hs-source-dirs: src-core
561+
exposed-modules:
540562
Database.LSMTree.Internal.Arena
541563
Database.LSMTree.Internal.Assertions
542564
Database.LSMTree.Internal.BitMath
@@ -593,27 +615,25 @@ library
593615
Database.LSMTree.Internal.WriteBufferBlobs
594616
Database.LSMTree.Internal.WriteBufferReader
595617
Database.LSMTree.Internal.WriteBufferWriter
596-
Database.LSMTree.Simple
597618

598619
build-depends:
599620
, base >=4.16 && <4.22
600621
, bitvec ^>=1.1
601622
, blockio ^>=0.1
602-
, bloomfilter-blocked
623+
, bloomfilter-blocked ^>=0.1
603624
, bytestring ^>=0.11.4.0 || ^>=0.12.1.0
604625
, cborg ^>=0.2.10.0
605626
, containers ^>=0.6 || ^>=0.7
606627
, contra-tracer ^>=0.1 || ^>=0.2
607628
, crc32c ^>=0.2.1
608629
, deepseq ^>=1.4 || ^>=1.5
609-
, filepath
630+
, filepath ^>=1.5
610631
, fs-api ^>=0.4
611632
, io-classes ^>=1.6 || ^>=1.7 || ^>=1.8.0.1
612633
, io-classes:strict-mvar
613634
, lsm-tree:control
614635
, lsm-tree:kmerge
615636
, primitive ^>=0.9
616-
, random ^>=1.0 || ^>=1.1 || ^>=1.2 || ^>=1.3
617637
, serialise ^>=0.2
618638
, text ^>=2.1.1
619639
, utf8-string ^>=1.0
@@ -656,6 +676,7 @@ library extras
656676
, io-classes:strict-stm
657677
, lsm-tree
658678
, lsm-tree:control
679+
, lsm-tree:core
659680
, lsm-tree:kmerge
660681
, lsm-tree:prototypes
661682
, nonempty-containers
@@ -668,10 +689,10 @@ library extras
668689
, wide-word
669690

670691
test-suite lsm-tree-test
671-
import: language, warnings, wno-x-partial
672-
type: exitcode-stdio-1.0
673-
hs-source-dirs: test
674-
main-is: Main.hs
692+
import: language, warnings, wno-x-partial
693+
type: exitcode-stdio-1.0
694+
hs-source-dirs: test
695+
main-is: Main.hs
675696
other-modules:
676697
Database.LSMTree.Class
677698
Database.LSMTree.Class.Common
@@ -735,6 +756,7 @@ test-suite lsm-tree-test
735756
Test.Util.RawPage
736757
Test.Util.TypeFamilyWrappers
737758

759+
autogen-modules: Paths_lsm_tree
738760
build-depends:
739761
, ansi-terminal
740762
, barbies
@@ -761,6 +783,7 @@ test-suite lsm-tree-test
761783
, io-sim
762784
, lsm-tree
763785
, lsm-tree:control
786+
, lsm-tree:core
764787
, lsm-tree:extras
765788
, lsm-tree:prototypes
766789
, mtl
@@ -787,7 +810,7 @@ test-suite lsm-tree-test
787810
, vector-algorithms
788811
, wide-word
789812

790-
ghc-options: -threaded
813+
ghc-options: -threaded
791814

792815
benchmark lsm-tree-micro-bench
793816
import: language, warnings, wno-x-partial
@@ -818,6 +841,7 @@ benchmark lsm-tree-micro-bench
818841
, fs-api
819842
, lsm-tree
820843
, lsm-tree:control
844+
, lsm-tree:core
821845
, lsm-tree:extras
822846
, QuickCheck
823847
, random
@@ -834,7 +858,7 @@ benchmark lsm-tree-bench-bloomfilter
834858
build-depends:
835859
, base <5
836860
, bloomfilter-blocked
837-
, lsm-tree
861+
, lsm-tree:core
838862
, lsm-tree:extras
839863
, random
840864
, time
@@ -855,8 +879,8 @@ benchmark lsm-tree-bench-lookups
855879
, deepseq
856880
, fs-api
857881
, io-classes
858-
, lsm-tree
859882
, lsm-tree:control
883+
, lsm-tree:core
860884
, lsm-tree:extras
861885
, primitive
862886
, random
@@ -993,8 +1017,8 @@ library kmerge
9931017

9941018
build-depends:
9951019
, base <5
996-
, indexed-traversable
997-
, primitive
1020+
, indexed-traversable ^>=0.1
1021+
, primitive ^>=0.9
9981022

9991023
test-suite kmerge-test
10001024
import: language, warnings, wno-x-partial
@@ -1042,7 +1066,7 @@ test-suite map-range-test
10421066
, base >=4.16 && <4.22
10431067
, bytestring
10441068
, containers
1045-
, lsm-tree
1069+
, lsm-tree:core
10461070
, QuickCheck
10471071
, tasty
10481072
, tasty-hunit
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)