hash-addressed-0.0.1.0: Hash-addressed file storage
Safe HaskellSafe-Inferred
LanguageGHC2021

HashAddressed.Directory

Synopsis

Type

init Source #

Arguments

:: HashFunction

Which hash function to use

-> FilePath

Directory where content-addressed files are stored

-> ContentAddressedDirectory 

Specification of a content-addressed directory

Write operations

writeLazy Source #

Arguments

:: ContentAddressedDirectory

The content-addressed file store to write to; see init

-> ByteString

The content to write to the store

-> IO WriteResult

The file path where the contents of the lazy byte string now reside. This path includes the store directory.

Write a lazy byte string to a content-addressed directory

This is a simplified variant of writeStreaming.

writeStreaming Source #

Arguments

:: ContentAddressedDirectory

The content-addressed file store to write to; see init

-> (forall m. MonadIO m => (ByteString -> m ()) -> m ())

Monadic action which is allowed to emit ByteStrings and do I/O. If this action throws an exception, nothing will be written to the store.

-> IO WriteResult 

Write a stream of strict byte strings to a content-addressed directory

This is a simplified variant of writeEither.

writeEither Source #

Arguments

:: ContentAddressedDirectory

The content-addressed file store to write to; see init

-> (forall m. MonadIO m => (ByteString -> m ()) -> m (Either bad good))

Monadic action which is allowed to emit ByteStrings and do I/O. The action should return Right once the content has been successfully written. If the action returns Left or throws an exception, then nothing will be committed to the store.

-> IO (Either bad (good, WriteResult)) 

Write a stream of strict byte strings to a content-addressed directory

data WriteResult Source #

Constructors

WriteResult 

Fields