summaryrefslogtreecommitdiff
path: root/src/Storage.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-07-16 17:20:29 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-07-16 17:20:29 +0200
commitcfdbb5b70abcede5e9ed980db5dd12a6764bb3f0 (patch)
tree5bba35c2585687dcebfe229b240079e3c20f522c /src/Storage.hs
parent3c05d0cbd310af1c34d3731a15feb2a9508aded2 (diff)
Test: store command for arbitrary type and data
Diffstat (limited to 'src/Storage.hs')
-rw-r--r--src/Storage.hs12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/Storage.hs b/src/Storage.hs
index cc2476f..e1bce3c 100644
--- a/src/Storage.hs
+++ b/src/Storage.hs
@@ -52,14 +52,12 @@ module Storage (
beginHistory, modifyHistory,
) where
-import Codec.Compression.Zlib
import qualified Codec.MIME.Type as MIME
import qualified Codec.MIME.Parse as MIME
import Control.Applicative
import Control.Arrow
import Control.Concurrent
-import Control.DeepSeq
import Control.Exception
import Control.Monad
import Control.Monad.Except
@@ -247,16 +245,6 @@ storeObject = unsafeStoreObject
storeRawBytes :: PartialStorage -> BL.ByteString -> IO PartialRef
storeRawBytes = unsafeStoreRawBytes
-unsafeStoreRawBytes :: Storage' c -> BL.ByteString -> IO (Ref' c)
-unsafeStoreRawBytes st raw = do
- let dgst = hashToRefDigest raw
- case stBacking st of
- StorageDir { dirPath = sdir } -> writeFileOnce (refPath sdir dgst) $ compress raw
- StorageMemory { memObjs = tobjs } ->
- dgst `deepseq` -- the TVar may be accessed when evaluating the data to be written
- modifyMVar_ tobjs (return . M.insert dgst raw)
- return $ Ref st dgst
-
serializeRecItem :: ByteString -> RecItem' c -> [ByteString]
serializeRecItem name (RecInt x) = [name, BC.pack ":i", BC.singleton ' ', BC.pack (show x), BC.singleton '\n']
serializeRecItem name (RecNum x) = [name, BC.pack ":n", BC.singleton ' ', BC.pack (showRatio x), BC.singleton '\n']