filestore-0.6.5: Interface for versioning file stores.
CopyrightCopyright (C) 2009 John MacFarlane
LicenseBSD 3
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Stabilityalpha
PortabilityGHC 6.10 required
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.FileStore.Types

Description

Type definitions for Data.FileStore.

Synopsis

Documentation

type RevisionId = String Source #

data Resource Source #

Constructors

FSFile FilePath 
FSDirectory FilePath 

Instances

Instances details
Read Resource Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS Resource

readList :: ReadS [Resource]

readPrec :: ReadPrec Resource

readListPrec :: ReadPrec [Resource]

Show Resource Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> Resource -> ShowS

show :: Resource -> String

showList :: [Resource] -> ShowS

Eq Resource Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: Resource -> Resource -> Bool

(/=) :: Resource -> Resource -> Bool

Ord Resource Source # 
Instance details

Defined in Data.FileStore.Types

Methods

compare :: Resource -> Resource -> Ordering

(<) :: Resource -> Resource -> Bool

(<=) :: Resource -> Resource -> Bool

(>) :: Resource -> Resource -> Bool

(>=) :: Resource -> Resource -> Bool

max :: Resource -> Resource -> Resource

min :: Resource -> Resource -> Resource

data Author Source #

Constructors

Author 

Fields

Instances

Instances details
Read Author Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS Author

readList :: ReadS [Author]

readPrec :: ReadPrec Author

readListPrec :: ReadPrec [Author]

Show Author Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> Author -> ShowS

show :: Author -> String

showList :: [Author] -> ShowS

Eq Author Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: Author -> Author -> Bool

(/=) :: Author -> Author -> Bool

data Change Source #

Constructors

Added FilePath 
Deleted FilePath 
Modified FilePath 

Instances

Instances details
Read Change Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS Change

readList :: ReadS [Change]

readPrec :: ReadPrec Change

readListPrec :: ReadPrec [Change]

Show Change Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> Change -> ShowS

show :: Change -> String

showList :: [Change] -> ShowS

Eq Change Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: Change -> Change -> Bool

(/=) :: Change -> Change -> Bool

type Description = String Source #

data Revision Source #

Instances

Instances details
Read Revision Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS Revision

readList :: ReadS [Revision]

readPrec :: ReadPrec Revision

readListPrec :: ReadPrec [Revision]

Show Revision Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> Revision -> ShowS

show :: Revision -> String

showList :: [Revision] -> ShowS

Eq Revision Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: Revision -> Revision -> Bool

(/=) :: Revision -> Revision -> Bool

class Contents a where Source #

Methods

fromByteString :: ByteString -> a Source #

toByteString :: a -> ByteString Source #

Instances

Instances details
Contents ByteString Source # 
Instance details

Defined in Data.FileStore.Types

Methods

fromByteString :: ByteString -> ByteString Source #

toByteString :: ByteString -> ByteString Source #

Contents String Source # 
Instance details

Defined in Data.FileStore.Types

Methods

fromByteString :: ByteString -> String Source #

toByteString :: String -> ByteString Source #

data TimeRange Source #

Constructors

TimeRange 

Fields

Instances

Instances details
Read TimeRange Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS TimeRange

readList :: ReadS [TimeRange]

readPrec :: ReadPrec TimeRange

readListPrec :: ReadPrec [TimeRange]

Show TimeRange Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> TimeRange -> ShowS

show :: TimeRange -> String

showList :: [TimeRange] -> ShowS

Eq TimeRange Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: TimeRange -> TimeRange -> Bool

(/=) :: TimeRange -> TimeRange -> Bool

data MergeInfo Source #

Constructors

MergeInfo 

Fields

Instances

Instances details
Read MergeInfo Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS MergeInfo

readList :: ReadS [MergeInfo]

readPrec :: ReadPrec MergeInfo

readListPrec :: ReadPrec [MergeInfo]

Show MergeInfo Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> MergeInfo -> ShowS

show :: MergeInfo -> String

showList :: [MergeInfo] -> ShowS

Eq MergeInfo Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: MergeInfo -> MergeInfo -> Bool

(/=) :: MergeInfo -> MergeInfo -> Bool

data FileStoreError Source #

Constructors

RepositoryExists

Tried to initialize a repo that exists

ResourceExists

Tried to create a resource that exists

NotFound

Requested resource was not found

IllegalResourceName

The specified resource name is illegal

Unchanged

The resource was not modified, because the contents were unchanged

UnsupportedOperation 
NoMaxCount

The darcs version used does not support --max-count

UnknownError String 

Instances

Instances details
Exception FileStoreError Source # 
Instance details

Defined in Data.FileStore.Types

Methods

toException :: FileStoreError -> SomeException

fromException :: SomeException -> Maybe FileStoreError

displayException :: FileStoreError -> String

Read FileStoreError Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS FileStoreError

readList :: ReadS [FileStoreError]

readPrec :: ReadPrec FileStoreError

readListPrec :: ReadPrec [FileStoreError]

Show FileStoreError Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> FileStoreError -> ShowS

show :: FileStoreError -> String

showList :: [FileStoreError] -> ShowS

Eq FileStoreError Source # 
Instance details

Defined in Data.FileStore.Types

data SearchMatch Source #

Constructors

SearchMatch 

Fields

Instances

Instances details
Read SearchMatch Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS SearchMatch

readList :: ReadS [SearchMatch]

readPrec :: ReadPrec SearchMatch

readListPrec :: ReadPrec [SearchMatch]

Show SearchMatch Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> SearchMatch -> ShowS

show :: SearchMatch -> String

showList :: [SearchMatch] -> ShowS

Eq SearchMatch Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: SearchMatch -> SearchMatch -> Bool

(/=) :: SearchMatch -> SearchMatch -> Bool

data SearchQuery Source #

Constructors

SearchQuery 

Fields

Instances

Instances details
Read SearchQuery Source # 
Instance details

Defined in Data.FileStore.Types

Methods

readsPrec :: Int -> ReadS SearchQuery

readList :: ReadS [SearchQuery]

readPrec :: ReadPrec SearchQuery

readListPrec :: ReadPrec [SearchQuery]

Show SearchQuery Source # 
Instance details

Defined in Data.FileStore.Types

Methods

showsPrec :: Int -> SearchQuery -> ShowS

show :: SearchQuery -> String

showList :: [SearchQuery] -> ShowS

Eq SearchQuery Source # 
Instance details

Defined in Data.FileStore.Types

Methods

(==) :: SearchQuery -> SearchQuery -> Bool

(/=) :: SearchQuery -> SearchQuery -> Bool

data UTCTime #

Instances

Instances details
Data UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime

toConstr :: UTCTime -> Constr

dataTypeOf :: UTCTime -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime)

gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r

gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime

NFData UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

rnf :: UTCTime -> ()

Eq UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

(==) :: UTCTime -> UTCTime -> Bool

(/=) :: UTCTime -> UTCTime -> Bool

Ord UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

compare :: UTCTime -> UTCTime -> Ordering

(<) :: UTCTime -> UTCTime -> Bool

(<=) :: UTCTime -> UTCTime -> Bool

(>) :: UTCTime -> UTCTime -> Bool

(>=) :: UTCTime -> UTCTime -> Bool

max :: UTCTime -> UTCTime -> UTCTime

min :: UTCTime -> UTCTime -> UTCTime

data FileStore Source #

A versioning filestore, which can be implemented using the file system, a database, or revision-control software.

Constructors

FileStore 

Fields

  • initialize :: IO ()

    Initialize a new filestore.

  • save :: forall a. Contents a => FilePath -> Author -> Description -> a -> IO ()

    Save contents in the filestore.

  • retrieve :: forall a. Contents a => FilePath -> Maybe RevisionId -> IO a

    Retrieve the contents of the named resource.

  • delete :: FilePath -> Author -> Description -> IO ()

    Delete a named resource, providing author and log message.

  • rename :: FilePath -> FilePath -> Author -> Description -> IO ()

    Rename a resource, providing author and log message.

  • history :: [FilePath] -> TimeRange -> Maybe Int -> IO [Revision]

    Get history for a list of named resources in a (possibly openended) time range. If the list is empty, history for all resources will be returned. If the TimeRange is 2 Nothings, history for all dates will be returned.

  • latest :: FilePath -> IO RevisionId

    Return the revision ID of the latest change for a resource. Raises NotFound if the resource is not found.

  • revision :: RevisionId -> IO Revision

    Return information about a revision, given the ID. Raises NotFound if there is no such revision.

  • index :: IO [FilePath]

    Return a list of resources in the filestore.

  • directory :: FilePath -> IO [Resource]

    Return a list of resources in a directory of the filestore.

  • idsMatch :: RevisionId -> RevisionId -> Bool

    True if the revision IDs match, in the sense that the can be treated as specifying the same revision.

  • search :: SearchQuery -> IO [SearchMatch]

    Search the filestore for patterns.