ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.Storage.FS.API

Description

An abstract view over the filesystem.

Synopsis

Documentation

data Handle h Source #

Constructors

Handle

Fields

Instances

Instances details
Eq h => Eq ( Handle h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API.Types

Show ( Handle h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API.Types

Generic ( Handle h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API.Types

Associated Types

type Rep ( Handle h) :: Type -> Type Source #

NoThunks ( Handle h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API.Types

Condense ( Handle h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API.Types

type Rep ( Handle h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API.Types

type Rep ( Handle h) = D1 (' MetaData "Handle" "Ouroboros.Consensus.Storage.FS.API.Types" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" ' False ) ( C1 (' MetaCons "Handle" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "handleRaw") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 h) :*: S1 (' MetaSel (' Just "handlePath") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 FsPath )))

data HasFS m h Source #

Constructors

HasFS

Fields

data SomeHasFS m where Source #

It is often inconvenient to have to parameterise over h . One often makes it existential, losing the ability to use derive Generic and NoThunks . This data type hides an existential h parameter of a HasFS and provides a NoThunks thunks instance.

Constructors

SomeHasFS :: Eq h => HasFS m h -> SomeHasFS m

hClose' :: ( HasCallStack , Monad m) => HasFS m h -> Handle h -> m Bool Source #

Returns True when the handle was still open.

hGetAll :: Monad m => HasFS m h -> Handle h -> m ByteString Source #

Read all the data from the given file handle 64kB at a time.

Stops when EOF is reached.

hGetAllAt Source #

Arguments

:: Monad m
=> HasFS m h
-> Handle h
-> AbsOffset

The offset at which to read.

-> m ByteString

Like hGetAll , but is thread safe since it does not change or depend on the file offset. pread syscall is used internally.

hGetExactly :: forall m h. ( HasCallStack , MonadThrow m) => HasFS m h -> Handle h -> Word64 -> m ByteString Source #

Makes sure it reads all requested bytes. If eof is found before all bytes are read, it throws an exception.

hGetExactlyAt Source #

Arguments

:: forall m h. ( HasCallStack , MonadThrow m)
=> HasFS m h
-> Handle h
-> Word64

The number of bytes to read.

-> AbsOffset

The offset at which to read.

-> m ByteString

Like hGetExactly , but is thread safe since it does not change or depend on the file offset. pread syscall is used internally.

hPut :: forall m h. ( HasCallStack , Monad m) => HasFS m h -> Handle h -> Builder -> m Word64 Source #

This function makes sure that the whole Builder is written.

The chunk size of the resulting ByteString determines how much memory will be used while writing to the handle.

hPutAll :: forall m h. ( HasCallStack , Monad m) => HasFS m h -> Handle h -> ByteString -> m Word64 Source #

This function makes sure that the whole ByteString is written.

hPutAllStrict :: forall m h. ( HasCallStack , Monad m) => HasFS m h -> Handle h -> ByteString -> m Word64 Source #

This function makes sure that the whole ByteString is written.