mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
b29d17aa4a
commit
f0c4756b11
|
@ -67,7 +67,7 @@ data ChunkWriter h m = forall a . ( MonadIO m
|
|||
, pipeline :: Pipeline m ()
|
||||
, dir :: FilePath
|
||||
, storage :: a
|
||||
, perBlock :: Cache FilePath (TQueue (Handle -> IO ()))
|
||||
, perBlock :: Cache FilePath (TQueue (IO ()))
|
||||
, perBlockSem :: Cache FilePath TSem
|
||||
}
|
||||
|
||||
|
@ -276,8 +276,8 @@ writeChunk2 w salt h o bs = do
|
|||
|
||||
liftIO $ do
|
||||
q <- Cache.fetchWithCache cache fn $ const Q0.newTQueueIO
|
||||
atomically $ Q0.writeTQueue q $ \fh -> do
|
||||
-- withBinaryFile fn ReadWriteMode $ \fh -> do
|
||||
atomically $ Q0.writeTQueue q $ do
|
||||
withBinaryFile fn ReadWriteMode $ \fh -> do
|
||||
hSeek fh AbsoluteSeek (fromIntegral o)
|
||||
B.hPutStr fh bs
|
||||
-- hFlush fh
|
||||
|
@ -334,8 +334,8 @@ flush w fn = do
|
|||
liftIO $ do
|
||||
|
||||
-- withBinaryFile fn ReadWriteMode $ \fh -> do
|
||||
withBinaryFile fn ReadWriteMode $ \fh -> do
|
||||
for_ flushed $ \f -> f fh
|
||||
-- withBinaryFile fn ReadWriteMode $ \fh -> do
|
||||
for_ flushed id
|
||||
|
||||
atomically $ Sem.signalTSem s
|
||||
|
||||
|
|
|
@ -50,10 +50,11 @@ main = do
|
|||
|
||||
w2 <- replicateM 1 $ async $ runChunkWriter cw
|
||||
|
||||
-- psz' <- shuffleM psz
|
||||
psz' <- pure psz
|
||||
psz' <- shuffleM psz
|
||||
-- psz' <- pure psz
|
||||
|
||||
forConcurrently_ psz' $ \(o,s) -> do
|
||||
-- forConcurrently_ psz' $ \(o,s) -> do
|
||||
forM_ psz' $ \(o,s) -> do
|
||||
let t = B8.take s $ B8.drop o bytes
|
||||
writeChunk cw 1 hash (fromIntegral o) t
|
||||
|
||||
|
|
Loading…
Reference in New Issue