@@ -17,25 +17,26 @@ module Database.LSMTree.Model.IO (
1717import Control.Concurrent.Class.MonadSTM.Strict
1818import Control.Exception (Exception )
1919import Control.Monad.Class.MonadThrow (MonadThrow (.. ))
20+ import qualified Data.Vector as V
2021import qualified Database.LSMTree.Class as Class
2122import Database.LSMTree.Model.Session (TableConfig (.. ))
2223import qualified Database.LSMTree.Model.Session as Model
2324
2425newtype Session m = Session (StrictTVar m (Maybe Model. Model ))
2526
2627data Table m k v b = Table {
27- _thSession :: ! (Session m )
28- , _thTable :: ! (Model. Table k v b )
28+ thSession :: ! (Session m )
29+ , thTable :: ! (Model. Table k v b )
2930 }
3031
3132data BlobRef m b = BlobRef {
32- _brSession :: ! (Session m )
33- , _brBlobRef :: ! (Model. BlobRef b )
33+ brSession :: ! (Session m )
34+ , brBlobRef :: ! (Model. BlobRef b )
3435 }
3536
3637data Cursor m k v b = Cursor {
37- _cSession :: ! (Session m )
38- , _cCursor :: ! (Model. Cursor k v b )
38+ cSession :: ! (Session m )
39+ , cCursor :: ! (Model. Cursor k v b )
3940 }
4041
4142newtype Err = Err (Model. Err )
@@ -76,7 +77,7 @@ instance Class.IsTable Table where
7677
7778 rangeLookup (Table s t) x1 = fmap (fmap (BlobRef s)) <$>
7879 runInOpenSession s (Model. rangeLookup x1 t)
79- retrieveBlobs _ s x1 = runInOpenSession s (Model. retrieveBlobs (fmap _brBlobRef x1))
80+ retrieveBlobs _ s x1 = runInOpenSession s (Model. retrieveBlobs (fmap brBlobRef x1))
8081
8182 newCursor k (Table s t) = Cursor s <$> runInOpenSession s (Model. newCursor k t)
8283 closeCursor _ (Cursor s c) = runInOpenSession s (Model. closeCursor c)
@@ -90,3 +91,8 @@ instance Class.IsTable Table where
9091
9192 union (Table s1 t1) (Table _s2 t2) =
9293 Table s1 <$> runInOpenSession s1 (Model. union Model. getResolve t1 t2)
94+
95+ unions ts =
96+ Table s <$> runInOpenSession s (Model. unions Model. getResolve (V. map thTable ts))
97+ where
98+ Table s _ = V. head ts
0 commit comments