Holumbus-Storage-0.0.1: a distributed storage systemSource codeContentsIndex
MaintainerStefan Schmidt (stefanschmidt@web.de)
file datatypes
file operation
storage typeclass

Version : 0.1

This Module contains the typeclass of a storage and the associated datatypes.

type FileId = String
type FileContent = ByteString
getContentLength :: FileContent -> Integer
data FileData = MkFileData {
fd_FileId :: FileId
fd_Size :: Integer
fd_CreationDate :: UTCTime
fd_LastModifiedDate :: UTCTime
fd_Hashvalue :: Integer
createFileData :: FileId -> FileContent -> IO FileData
updateFileData :: FileData -> FileData -> FileData
class Storage s where
openStorage :: s -> IO s
closeStorage :: s -> IO s
createFile :: s -> FileId -> FileContent -> IO s
deleteFile :: s -> FileId -> IO s
appendFile :: s -> FileId -> FileContent -> IO s
containsFile :: s -> FileId -> IO Bool
getFileContent :: s -> FileId -> IO (Maybe FileContent)
getFileData :: s -> FileId -> IO (Maybe FileData)
getFileIds :: s -> IO [FileId]
file datatypes
type FileId = StringSource
The file-identifier, should be unique in the whole system and be an instance of the classes show, eq, ord and binary
type FileContent = ByteStringSource
file operation
getContentLength :: FileContent -> IntegerSource
data FileData Source
metadata of a file, known by the storage.
fd_FileId :: FileIdfilename
fd_Size :: Integerfilesize
fd_CreationDate :: UTCTimecreation date
fd_LastModifiedDate :: UTCTimelast modified date
fd_Hashvalue :: Integerhash value
show/hide Instances
createFileData :: FileId -> FileContent -> IO FileDataSource
Create a new file data item.
updateFileData :: FileData -> FileData -> FileDataSource
Updates a new file data item with the date, size and hash value of an old one. First parameter is the new item, second the old one.
storage typeclass
class Storage s whereSource
The interface of a storage.
openStorage :: s -> IO sSource
Initialize the storage.
closeStorage :: s -> IO sSource
Deinitialize the storage.
createFile :: s -> FileId -> FileContent -> IO sSource
Create a new file in the storage. Overwrite the file if it already exists.
deleteFile :: s -> FileId -> IO sSource
Delete a file in the storage. Nothing happens if the file doesn't exist
appendFile :: s -> FileId -> FileContent -> IO sSource
Append the content of the file. Create a new file, if it doesn't already exist
containsFile :: s -> FileId -> IO BoolSource
Check if the file is already in the storage
getFileContent :: s -> FileId -> IO (Maybe FileContent)Source
Get the content of a file. Return Nothing, if the file doesn't exist
getFileData :: s -> FileId -> IO (Maybe FileData)Source
Get the metadata of a file. Return Nothing, if the file doesn't exist
getFileIds :: s -> IO [FileId]Source
List the files in the storage
show/hide Instances
Produced by Haddock version 2.4.2