Holumbus-Storage-0.1.0: a distributed storage system

MaintainerStefan Schmidt (stefanschmidt@web.de)




Version : 0.1

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


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

file operation


data FileData Source

metadata of a file, known by the storage.




fd_FileId :: FileId


fd_Size :: Integer


fd_CreationDate :: UTCTime

creation date

fd_LastModifiedDate :: UTCTime

last modified date

fd_Hashvalue :: Integer

hash value

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.

createFiles :: s -> [(FileId, FileContent)] -> IO sSource

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


Storage FileStorage

deriving FileStorage from the class Storage