mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
0c71a7dab0
commit
39ac3e8832
|
@ -120,10 +120,7 @@ type NCQSize = Word32
|
||||||
type StateVersion = Word64
|
type StateVersion = Word64
|
||||||
|
|
||||||
data NCQIdxEntry =
|
data NCQIdxEntry =
|
||||||
NCQIdxEntry
|
NCQIdxEntry {-# UNPACK#-} !NCQOffset !NCQSize
|
||||||
{ ncqIdxEntryOffset :: !NCQOffset
|
|
||||||
, ncqIdxEntrySize :: !NCQSize
|
|
||||||
}
|
|
||||||
|
|
||||||
data StateOP = D FileKey | F TimeSpec FileKey | P FileKey
|
data StateOP = D FileKey | F TimeSpec FileKey | P FileKey
|
||||||
deriving (Eq,Ord,Show)
|
deriving (Eq,Ord,Show)
|
||||||
|
@ -547,7 +544,11 @@ ncqLocateActually ncq href = do
|
||||||
ncqLocate2 :: MonadUnliftIO m => NCQStorage2 -> HashRef -> m (Maybe Location)
|
ncqLocate2 :: MonadUnliftIO m => NCQStorage2 -> HashRef -> m (Maybe Location)
|
||||||
ncqLocate2 NCQStorage2{..} href = do
|
ncqLocate2 NCQStorage2{..} href = do
|
||||||
answ <- newEmptyTMVarIO
|
answ <- newEmptyTMVarIO
|
||||||
atomically $ writeTQueue ncqReadReq (href, answ)
|
|
||||||
|
atomically do
|
||||||
|
modifyTVar ncqWrites succ
|
||||||
|
writeTQueue ncqReadReq (href, answ)
|
||||||
|
|
||||||
atomically $ takeTMVar answ
|
atomically $ takeTMVar answ
|
||||||
|
|
||||||
data RunSt =
|
data RunSt =
|
||||||
|
@ -1370,7 +1371,7 @@ ncqCompactStep me@NCQStorage2{..} = withSem ncqMergeSem $ flip runContT pure $ c
|
||||||
getProfit fk tombs = do
|
getProfit fk tombs = do
|
||||||
(bs,nw) <- viewIndex fk
|
(bs,nw) <- viewIndex fk
|
||||||
r <- S.toList_ $ nwayHashScanAll nw bs$ \_ k v -> do
|
r <- S.toList_ $ nwayHashScanAll nw bs$ \_ k v -> do
|
||||||
when (HS.member (coerce k) tombs) $ S.yield $ ncqIdxEntrySize (decodeEntry v)
|
when (HS.member (coerce k) tombs) $ S.yield $ let (NCQIdxEntry _ s) = decodeEntry v in s
|
||||||
pure (sum r)
|
pure (sum r)
|
||||||
|
|
||||||
getGargabeSlow :: MonadIO m => FileKey -> HashSet HashRef -> m (HashMap HashRef NCQSize)
|
getGargabeSlow :: MonadIO m => FileKey -> HashSet HashRef -> m (HashMap HashRef NCQSize)
|
||||||
|
|
Loading…
Reference in New Issue