hit-0.6.3: Git operations in haskell

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unix
Safe Haskell | None
Language | Haskell98

Data.Git.Storage.Object

Contents

- parsing function
- writing function

Description

Synopsis

- data ObjectLocation
  - = NotFound
  - | Loose Ref
  - | Packed Ref Word64
- data ObjectType
  - = TypeTree
  - | TypeBlob
  - | TypeCommit
  - | TypeTag
  - | TypeDeltaOff
  - | TypeDeltaRef
- type ObjectHeader = (ObjectType, Word64, Maybe ObjectPtr)
- type ObjectData = ByteString
- data ObjectPtr
  - = PtrRef Ref
  - | PtrOfs Word64
- data Object
  - = ObjCommit Commit
  - | ObjTag Tag
  - | ObjBlob Blob
  - | ObjTree Tree
  - | ObjDeltaOfs DeltaOfs
  - | ObjDeltaRef DeltaRef
- data ObjectInfo = ObjectInfo {
  - oiHeader :: ObjectHeader
  - oiData :: ObjectData
  - oiChains :: [ObjectPtr]
  }
- class Objectable a where
- objectToType :: Object -> ObjectType
- objectTypeMarshall :: ObjectType -> String
- objectTypeUnmarshall :: String -> ObjectType
- objectTypeIsDelta :: ObjectType -> Bool
- objectIsDelta :: Object -> Bool
- objectToTree :: Object -> Maybe Tree
- objectToCommit :: Object -> Maybe Commit
- objectToTag :: Object -> Maybe Tag
- objectToBlob :: Object -> Maybe Blob
- treeParse :: Parser ByteString Tree
- commitParse :: Parser ByteString Commit
- tagParse :: Parser ByteString Tag
- blobParse :: Parser ByteString Blob
- objectParseTree :: Parser ByteString Object
- objectParseCommit :: Parser ByteString Object
- objectParseTag :: Parser ByteString Object
- objectParseBlob :: Parser ByteString Object
- objectWriteHeader :: ObjectType -> Word64 -> ByteString
- objectWrite :: Object -> ByteString
- objectHash :: ObjectType -> Word64 -> ByteString -> Ref

# Documentation

data ObjectLocation #

location of an object in the database

Constructors

NotFound |
Loose Ref |
Packed Ref Word64 |

Instances

Eq ObjectLocation # |
Methods (==) :: ObjectLocation -> ObjectLocation -> Bool # (/=) :: ObjectLocation -> ObjectLocation -> Bool #
Show ObjectLocation # |
Methods showsPrec :: Int -> ObjectLocation -> ShowS # show :: ObjectLocation -> String # showList :: [ObjectLocation] -> ShowS #

data ObjectType #

type of a git object.

Constructors

TypeTree |
TypeBlob |
TypeCommit |
TypeTag |
TypeDeltaOff |
TypeDeltaRef |

Instances

Enum ObjectType # | the enum instance is useful when marshalling to pack file.
Methods succ :: ObjectType -> ObjectType # pred :: ObjectType -> ObjectType # toEnum :: Int -> ObjectType # fromEnum :: ObjectType -> Int # enumFrom :: ObjectType -> [ObjectType] # enumFromThen :: ObjectType -> ObjectType -> [ObjectType] # enumFromTo :: ObjectType -> ObjectType -> [ObjectType] # enumFromThenTo :: ObjectType -> ObjectType -> ObjectType -> [ObjectType] #
Eq ObjectType # |
Methods (==) :: ObjectType -> ObjectType -> Bool # (/=) :: ObjectType -> ObjectType -> Bool #
Data ObjectType # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ObjectType -> c ObjectType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ObjectType # toConstr :: ObjectType -> Constr # dataTypeOf :: ObjectType -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c ObjectType) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjectType) # gmapT :: (forall b. Data b => b -> b) -> ObjectType -> ObjectType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjectType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjectType -> r # gmapQ :: (forall d. Data d => d -> u) -> ObjectType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ObjectType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ObjectType -> m ObjectType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ObjectType -> m ObjectType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ObjectType -> m ObjectType #
Show ObjectType # |
Methods showsPrec :: Int -> ObjectType -> ShowS # show :: ObjectType -> String # showList :: [ObjectType] -> ShowS #

type ObjectHeader = (ObjectType, Word64, Maybe ObjectPtr) #

type ObjectData = ByteString #

data ObjectPtr #

Delta objects points to some others objects in the database either as offset in the pack or as a direct reference.

Constructors

PtrRef Ref |
PtrOfs Word64 |

Instances

Eq ObjectPtr # |
Methods (==) :: ObjectPtr -> ObjectPtr -> Bool # (/=) :: ObjectPtr -> ObjectPtr -> Bool #
Show ObjectPtr # |
Methods showsPrec :: Int -> ObjectPtr -> ShowS # show :: ObjectPtr -> String # showList :: [ObjectPtr] -> ShowS #

data Object #

describe a git object, that could of 6 differents types: tree, blob, commit, tag and deltas (offset or ref). the deltas one are only available in packs.

Constructors

ObjCommit Commit |
ObjTag Tag |
ObjBlob Blob |
ObjTree Tree |
ObjDeltaOfs DeltaOfs |
ObjDeltaRef DeltaRef |

Instances

Eq Object # |
Methods (==) :: Object -> Object -> Bool # (/=) :: Object -> Object -> Bool #
Show Object # |
Methods showsPrec :: Int -> Object -> ShowS # show :: Object -> String # showList :: [Object] -> ShowS #

data ObjectInfo #

Raw objects infos have an header (type, size, ptr), the data and a pointers chains to parents for resolved objects.

Constructors

ObjectInfo |
Fields oiHeader :: ObjectHeader oiData :: ObjectData oiChains :: [ObjectPtr]

Instances

Eq ObjectInfo # |
Methods (==) :: ObjectInfo -> ObjectInfo -> Bool # (/=) :: ObjectInfo -> ObjectInfo -> Bool #
Show ObjectInfo # |
Methods showsPrec :: Int -> ObjectInfo -> ShowS # show :: ObjectInfo -> String # showList :: [ObjectInfo] -> ShowS #

class Objectable a where #

Minimal complete definition

getType, getRaw, isDelta, toObject

Methods

getType :: a -> ObjectType #

getRaw :: a -> ByteString #

isDelta :: a -> Bool #

toObject :: a -> Object #

Instances

Objectable DeltaRef # |
Methods getType :: DeltaRef -> ObjectType # getRaw :: DeltaRef -> ByteString # isDelta :: DeltaRef -> Bool # toObject :: DeltaRef -> Object #
Objectable DeltaOfs # |
Methods getType :: DeltaOfs -> ObjectType # getRaw :: DeltaOfs -> ByteString # isDelta :: DeltaOfs -> Bool # toObject :: DeltaOfs -> Object #
Objectable Tag # |
Methods getType :: Tag -> ObjectType # getRaw :: Tag -> ByteString # isDelta :: Tag -> Bool # toObject :: Tag -> Object #
Objectable Commit # |
Methods getType :: Commit -> ObjectType # getRaw :: Commit -> ByteString # isDelta :: Commit -> Bool # toObject :: Commit -> Object #
Objectable Blob # |
Methods getType :: Blob -> ObjectType # getRaw :: Blob -> ByteString # isDelta :: Blob -> Bool # toObject :: Blob -> Object #
Objectable Tree # |
Methods getType :: Tree -> ObjectType # getRaw :: Tree -> ByteString # isDelta :: Tree -> Bool # toObject :: Tree -> Object #

objectToType :: Object -> ObjectType #

objectTypeMarshall :: ObjectType -> String #

objectTypeUnmarshall :: String -> ObjectType #

objectTypeIsDelta :: ObjectType -> Bool #

objectIsDelta :: Object -> Bool #

objectToTree :: Object -> Maybe Tree #

objectToCommit :: Object -> Maybe Commit #

objectToTag :: Object -> Maybe Tag #

objectToBlob :: Object -> Maybe Blob #

# parsing function

treeParse :: Parser ByteString Tree #

parse a tree content

commitParse :: Parser ByteString Commit #

parse a commit content

tagParse :: Parser ByteString Tag #

parse a tag content

blobParse :: Parser ByteString Blob #

parse a blob content

objectParseTree :: Parser ByteString Object #

objectParseCommit :: Parser ByteString Object #

objectParseTag :: Parser ByteString Object #

objectParseBlob :: Parser ByteString Object #

# writing function

objectWriteHeader :: ObjectType -> Word64 -> ByteString #

objectWrite :: Object -> ByteString #

objectHash :: ObjectType -> Word64 -> ByteString -> Ref #