filestore-0.3: Interface for versioning file stores.Source codeContentsIndex
Data.FileStore.Types
PortabilityGHC 6.10 required
Stabilityalpha
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Description
Type definitions for Data.FileStore.
Synopsis
type RevisionId = String
data Resource
= FSFile FilePath
| FSDirectory FilePath
data Author = Author {
authorName :: String
authorEmail :: String
}
data Change
= Added FilePath
| Deleted FilePath
| Modified FilePath
type Description = String
data Revision = Revision {
revId :: RevisionId
revDateTime :: DateTime
revAuthor :: Author
revDescription :: Description
revChanges :: [Change]
}
class Contents a where
fromByteString :: ByteString -> a
toByteString :: a -> ByteString
data TimeRange = TimeRange {
timeFrom :: Maybe DateTime
timeTo :: Maybe DateTime
}
data MergeInfo = MergeInfo {
mergeRevision :: Revision
mergeConflicts :: Bool
mergeText :: String
}
data FileStoreError
= RepositoryExists
| ResourceExists
| NotFound
| IllegalResourceName
| Unchanged
| UnsupportedOperation
| UnknownError String
data SearchMatch = SearchMatch {
matchResourceName :: FilePath
matchLineNumber :: Integer
matchLine :: String
}
data SearchQuery = SearchQuery {
queryPatterns :: [String]
queryWholeWords :: Bool
queryMatchAll :: Bool
queryIgnoreCase :: Bool
}
defaultSearchQuery :: SearchQuery
type DateTime = UTCTime
data FileStore = FileStore {
initialize :: IO ()
save :: Contents a => FilePath -> Author -> Description -> a -> IO ()
retrieve :: Contents a => FilePath -> Maybe RevisionId -> IO a
delete :: FilePath -> Author -> Description -> IO ()
rename :: FilePath -> FilePath -> Author -> Description -> IO ()
history :: [FilePath] -> TimeRange -> IO [Revision]
latest :: FilePath -> IO RevisionId
revision :: RevisionId -> IO Revision
index :: IO [FilePath]
directory :: FilePath -> IO [Resource]
idsMatch :: RevisionId -> RevisionId -> Bool
search :: SearchQuery -> IO [SearchMatch]
}
Documentation
type RevisionId = StringSource
data Resource Source
Constructors
FSFile FilePath
FSDirectory FilePath
show/hide Instances
data Author Source
Constructors
Author
authorName :: String
authorEmail :: String
show/hide Instances
data Change Source
Constructors
Added FilePath
Deleted FilePath
Modified FilePath
show/hide Instances
type Description = StringSource
data Revision Source
Constructors
Revision
revId :: RevisionId
revDateTime :: DateTime
revAuthor :: Author
revDescription :: Description
revChanges :: [Change]
show/hide Instances
class Contents a whereSource
Methods
fromByteString :: ByteString -> aSource
toByteString :: a -> ByteStringSource
show/hide Instances
data TimeRange Source
Constructors
TimeRange
timeFrom :: Maybe DateTimeNothing means no lower bound
timeTo :: Maybe DateTimeNothing means no upper bound
show/hide Instances
data MergeInfo Source
Constructors
MergeInfo
mergeRevision :: RevisionThe revision with which changes were merged
mergeConflicts :: BoolTrue if there were merge conflicts
mergeText :: StringThe merged text, including conflict markers
show/hide Instances
data FileStoreError Source
Constructors
RepositoryExistsTried to initialize a repository that already exists
ResourceExistsTried to create a resource that already exists
NotFoundRequested resource was not found
IllegalResourceNameThe specified resource name is illegal
UnchangedThe resource was not modified, because the contents were unchanged
UnsupportedOperation
UnknownError String
show/hide Instances
data SearchMatch Source
Constructors
SearchMatch
matchResourceName :: FilePath
matchLineNumber :: Integer
matchLine :: String
show/hide Instances
data SearchQuery Source
Constructors
SearchQuery
queryPatterns :: [String]Patterns to match
queryWholeWords :: BoolMatch patterns only with whole words?
queryMatchAll :: BoolReturn matches only from files in which all patterns match?
queryIgnoreCase :: BoolMake matches case-insensitive?
show/hide Instances
defaultSearchQuery :: SearchQuerySource
type DateTime = UTCTimeSource
data FileStore Source
A versioning filestore, which can be implemented using the file system, a database, or revision-control software.
Constructors
FileStore
initialize :: IO ()Initialize a new filestore.
save :: Contents a => FilePath -> Author -> Description -> a -> IO ()Save contents in the filestore.
retrieve :: Contents a => FilePath -> Maybe RevisionId -> IO aRetrieve 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 -> 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.
latest :: FilePath -> IO RevisionIdReturn the revision ID of the latest change for a resource. Raises NotFound if the resource is not found.
revision :: RevisionId -> IO RevisionReturn 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 -> BoolTrue 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.
Produced by Haddock version 2.6.0