Commit eaf5b2e 1 parent 267915b commit eaf5b2e Copy full SHA for eaf5b2e
File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import Control.Monad (replicateM)
36
36
import Data.Array
37
37
import Data.Binary
38
38
import Data.Binary.Get
39
+ import Data.Binary.Put
39
40
import Data.ByteString.Lazy (ByteString )
40
41
import qualified Data.ByteString.Lazy as B
41
42
import Data.List
@@ -107,7 +108,17 @@ readBlockArray h hdr idx =
107
108
}
108
109
where elc = blockSize hdr `quot` 8 -- Word64 is 8 bytes
109
110
110
- writeBlockArray = undefined
111
+ -- | Writes a 'BlockArray' object to disk.
112
+ writeBlockArray :: Device m h
113
+ => h
114
+ -> Header
115
+ -> BlockIndex
116
+ -> BlockArray
117
+ -> m ()
118
+
119
+ writeBlockArray h hdr idx ary = dPut h (blockIndexToAddress hdr idx) str
120
+ where str = runPut $ foldl put (pure () ) (elems $ blocks ary) >> putWord64le (nextArray ary)
121
+ put m e = m >> putWord64le e
111
122
112
123
linkBlockArray = undefined
113
124
You can’t perform that action at this time.
0 commit comments