git-annex sim command is working
Had to add Read instances to Key and NumCopies and some other similar types. I only expect to use those in serializing a sim. Of course, this risks that implementation changes break reading old data. For a sim, that would not be a big problem.
This commit is contained in:
parent
7e8274c6b7
commit
52891711d2
10 changed files with 284 additions and 155 deletions
|
@ -22,7 +22,7 @@ import qualified Data.Set as S
|
|||
import qualified Data.ByteString as S
|
||||
|
||||
newtype Group = Group S.ByteString
|
||||
deriving (Eq, Ord, Show)
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
fromGroup :: Group -> String
|
||||
fromGroup (Group g) = decodeBS g
|
||||
|
|
|
@ -68,7 +68,7 @@ instance NFData KeyData
|
|||
data Key = MkKey
|
||||
{ keyData :: KeyData
|
||||
, keySerialization :: S.ShortByteString
|
||||
} deriving (Show, Generic)
|
||||
} deriving (Show, Read, Generic)
|
||||
|
||||
instance Eq Key where
|
||||
-- comparing the serialization would be unnecessary work
|
||||
|
|
|
@ -44,7 +44,7 @@ import Control.Monad.IO.Class (MonadIO)
|
|||
import Data.Time.Clock.POSIX (POSIXTime)
|
||||
|
||||
newtype NumCopies = NumCopies Int
|
||||
deriving (Ord, Eq, Show)
|
||||
deriving (Ord, Eq, Show, Read)
|
||||
|
||||
-- Smart constructor; prevent configuring numcopies to 0 which would
|
||||
-- cause data loss.
|
||||
|
@ -57,7 +57,7 @@ fromNumCopies :: NumCopies -> Int
|
|||
fromNumCopies (NumCopies n) = n
|
||||
|
||||
newtype MinCopies = MinCopies Int
|
||||
deriving (Ord, Eq, Show)
|
||||
deriving (Ord, Eq, Show, Read)
|
||||
|
||||
configuredMinCopies :: Int -> MinCopies
|
||||
configuredMinCopies n
|
||||
|
|
|
@ -26,7 +26,7 @@ newtype RepoSize = RepoSize { fromRepoSize :: Integer }
|
|||
|
||||
-- The maximum size of a repo.
|
||||
newtype MaxSize = MaxSize { fromMaxSize :: Integer }
|
||||
deriving (Show, Eq, Ord)
|
||||
deriving (Show, Read, Eq, Ord)
|
||||
|
||||
-- An offset to the size of a repo.
|
||||
newtype SizeOffset = SizeOffset { fromSizeChange :: Integer }
|
||||
|
|
|
@ -22,7 +22,7 @@ import Data.Ord
|
|||
import Types.UUID
|
||||
|
||||
data TrustLevel = DeadTrusted | UnTrusted | SemiTrusted | Trusted
|
||||
deriving (Eq, Enum, Ord, Bounded, Show)
|
||||
deriving (Eq, Enum, Ord, Bounded, Show, Read)
|
||||
|
||||
instance Default TrustLevel where
|
||||
def = SemiTrusted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue