Extract a blockio
package from lsm-tree
#648
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Both the
HasBlockIO
API and simulation will have to be exposed in some manner to users of thelsm-tree
library. The former so that users can open a session, and the latter to make sure that users can also runlsm-tree
with a file system simulation. RecallopenSession
:lsm-tree/src/Database/LSMTree/Common.hs
Lines 182 to 189 in 5e72f1f
^ the answer to the TODO here is: I don't think that in general we can prevent the user from having to pass in
HasBlockIO
. Initialising aHasFS
is linked to initialising aHasBlockIO
, but the way in which we do this for the real file system and simulated file system is different:lsm-tree/blockio-api/src/System/FS/BlockIO/IO.hs
Lines 12 to 17 in 5e72f1f
lsm-tree/blockio-sim/src/System/FS/BlockIO/Sim.hs
Lines 148 to 155 in 5e72f1f
So we can't hide
HasBlockIO
from the user, it seems. And, as @wenkokke suggested, we should probably expose the API and simulation in a separate package.I had initially hoped we could re-export the necessary
blockio
definitions from the mainlsm-tree
library while keeping the sub-libraries hidden. However, since we shouldn't export the simulation (with dependencies on test libraries) from the public API, we would have to create a public sub-library with just the blockio simulation. At this point, it's probably better to have a separate package.BWT, I also made
blockio-sim
a public sub-library ofblockio-api
(i.e., now the component is identified byblockio:sim
). The reasoning here is that there are very few definitions inblockio-sim
, and one would have to depend onblockio-api
anyway to do anything with the simulation. As such, you could argue it's better not to separately publishblockio-sim
. As far as I understand,Hackage
has also gotten better at support for sub-libraries, see https://hackage.haskell.org/package/io-classes for example.