first pass at using new keys
It compiles. It sorta works. Several subcommands are FIXME marked and broken, because things that used to accept separate --backend and --key params need to be changed to accept just a --key that encodes all the key info, now that there is metadata in keys.
This commit is contained in:
parent
675ee89749
commit
9d49fe2c17
20 changed files with 116 additions and 123 deletions
|
@ -13,6 +13,7 @@ import System.Cmd.Utils
|
|||
import System.IO
|
||||
import System.Directory
|
||||
import Data.Maybe
|
||||
import System.Posix.Files
|
||||
|
||||
import qualified Backend.File
|
||||
import BackendTypes
|
||||
|
@ -23,6 +24,7 @@ import Content
|
|||
import Types
|
||||
import Utility
|
||||
import qualified SysConfig
|
||||
import Key
|
||||
|
||||
type SHASize = Int
|
||||
|
||||
|
@ -63,11 +65,16 @@ shaN size file = do
|
|||
where
|
||||
command = "sha" ++ (show size) ++ "sum"
|
||||
|
||||
-- A key is a checksum of its contents.
|
||||
{- A key is a checksum of its contents. -}
|
||||
keyValue :: SHASize -> FilePath -> Annex (Maybe Key)
|
||||
keyValue size file = do
|
||||
s <- shaN size file
|
||||
return $ Just $ Key (shaName size, s)
|
||||
stat <- liftIO $ getFileStatus file
|
||||
return $ Just $ stubKey {
|
||||
keyName = s,
|
||||
keyBackendName = shaName size,
|
||||
keySize = Just $ fromIntegral $ fileSize stat
|
||||
}
|
||||
|
||||
-- A key's checksum is checked during fsck.
|
||||
checkKeyChecksum :: SHASize -> Key -> Annex Bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue