@@ -13,6 +13,7 @@ module Glean.Database.Storage.LMDB
1313
1414import Control.Exception
1515import Data.Int
16+ import qualified Data.Text as Text
1617import Foreign.C.String
1718import Foreign.C.Types
1819import Foreign.ForeignPtr
@@ -126,7 +127,6 @@ instance Storage LMDB where
126127 createDirectoryIfMissing True $ takeDirectory target
127128 renameDirectory db target
128129
129-
130130containerPath :: LMDB -> Repo -> FilePath
131131containerPath LMDB {.. } repo = databasePath lmdbRoot repo </> " db"
132132
@@ -148,17 +148,16 @@ instance DatabaseOps (Database LMDB) where
148148 cacheOwnership (Database db) = cacheOwnership db
149149 prepareFactOwnerCache (Database db) = prepareFactOwnerCache db
150150
151- backup (Database db) scratch process = do
152- createDirectoryIfMissing True (scratch </> " backup" )
153- backup db scratch $ \ _ _ -> do
151+ backup (Database db) cfg scratch process =
152+ backup db cfg scratch $ \ path _ -> do
154153 withTempDirectory scratch " out" $ \ tmpdir -> do
155154 let out = tmpdir </> " db.squashfs"
156- callProcess " mksquashfs" [
157- scratch </> " backup" , out,
158- " -comp" , " zstd" , " -Xcompression-level" , " 8" ]
155+ callProcess " mksquashfs" $ [ path, out ] <>
156+ map Text. unpack (ServerConfig. config_db_lmdb_mksquashfs_args cfg)
159157 size <- getFileSize out
160158 process out (Data $ fromIntegral size)
161159
160+
162161foreign import ccall safe glean_lmdb_container_open
163162 :: CString
164163 -> CInt
0 commit comments