mirror of https://github.com/voidlizard/hbs2
real-test
This commit is contained in:
parent
98be2b056b
commit
fddf121371
|
@ -694,36 +694,37 @@ theDict = do
|
||||||
liftIO $ print $ pretty hash <+> pretty ssize
|
liftIO $ print $ pretty hash <+> pretty ssize
|
||||||
go (succ n)
|
go (succ n)
|
||||||
|
|
||||||
entry $ bindMatch "test:git:log:index:flat:search:binary:test" $ nil_ \case
|
entry $ bindMatch "test:reflog:index:search:binary:test" $ nil_ $ const $ lift do
|
||||||
[ StringLike fn ] -> do
|
|
||||||
|
|
||||||
lbs <- liftIO $ LBS.readFile fn
|
files <- listObjectIndexFiles
|
||||||
|
|
||||||
hashes <- S.toList_ $ runConsumeLBS lbs $ flip fix 0 \go n -> do
|
forConcurrently_ files $ \(fn,_) -> do
|
||||||
done <- consumed
|
|
||||||
if done then pure ()
|
|
||||||
else do
|
|
||||||
ssize <- readBytesMaybe 4
|
|
||||||
>>= orThrow SomeReadLogError
|
|
||||||
<&> fromIntegral . N.word32 . LBS.toStrict
|
|
||||||
|
|
||||||
hash <- readBytesMaybe 20
|
lbs <- liftIO $ LBS.readFile fn
|
||||||
>>= orThrow SomeReadLogError
|
|
||||||
<&> GitHash . LBS.toStrict
|
|
||||||
|
|
||||||
void $ readBytesMaybe 32
|
hashes <- S.toList_ $ runConsumeLBS lbs $ flip fix 0 \go n -> do
|
||||||
|
done <- consumed
|
||||||
|
if done then pure ()
|
||||||
|
else do
|
||||||
|
ssize <- readBytesMaybe 4
|
||||||
|
>>= orThrow SomeReadLogError
|
||||||
|
<&> fromIntegral . N.word32 . LBS.toStrict
|
||||||
|
|
||||||
lift $ S.yield hash
|
hash <- readBytesMaybe 20
|
||||||
go (succ n)
|
>>= orThrow SomeReadLogError
|
||||||
|
<&> GitHash . LBS.toStrict
|
||||||
|
|
||||||
file <- liftIO $ mmapFileByteString fn Nothing
|
void $ readBytesMaybe 32
|
||||||
|
|
||||||
for_ hashes $ \h -> do
|
lift $ S.yield hash
|
||||||
-- found <- binSearchBS 24 (BS.take 20 . BS.drop 4) ( show . pretty . GitHash ) (coerce h) file
|
go (succ n)
|
||||||
found <- liftIO $ binarySearchBS 56 (BS.take 20 . BS.drop 4) (coerce h) file
|
|
||||||
liftIO $ print $ pretty h <+> pretty (isJust found)
|
|
||||||
|
|
||||||
_ -> throwIO (BadFormException @C nil)
|
file <- liftIO $ mmapFileByteString fn Nothing
|
||||||
|
|
||||||
|
for_ hashes $ \h -> do
|
||||||
|
-- found <- binSearchBS 24 (BS.take 20 . BS.drop 4) ( show . pretty . GitHash ) (coerce h) file
|
||||||
|
found <- liftIO $ binarySearchBS 56 (BS.take 20 . BS.drop 4) (coerce h) file
|
||||||
|
liftIO $ notice $ pretty h <+> pretty (isJust found)
|
||||||
|
|
||||||
entry $ bindMatch "reflog:index:search" $ nil_ $ \syn -> lift $ flip runContT pure do
|
entry $ bindMatch "reflog:index:search" $ nil_ $ \syn -> lift $ flip runContT pure do
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue