ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Storage.FS.API

Description

An abstract view over the filesystem.

Synopsis

Documentation

data Handle h Source #

Constructors

Handle 

Fields

  • handleRaw ∷ !h

    The raw underlying handle

  • handlePath ∷ !FsPath

    The path corresponding to this handle

    This is primarily useful for error reporting.

Instances

Instances details
Eq h ⇒ Eq (Handle h) Source # 
Instance details

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

Methods

(==)Handle h → Handle h → Bool Source #

(/=)Handle h → Handle h → Bool Source #

Show (Handle h) Source # 
Instance details

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

Methods

showsPrecIntHandle h → ShowS Source #

showHandle h → String Source #

showList ∷ [Handle h] → ShowS Source #

Generic (Handle h) Source # 
Instance details

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

Associated Types

type Rep (Handle h) ∷ TypeType Source #

Methods

fromHandle h → Rep (Handle h) x Source #

toRep (Handle h) x → Handle h Source #

NoThunks (Handle h) Source # 
Instance details

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

Methods

noThunks ∷ Context → Handle h → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → Handle h → IO (Maybe ThunkInfo) #

showTypeOfProxy (Handle h) → String #

Condense (Handle h) Source # 
Instance details

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

Methods

condenseHandle h → String Source #

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.0-inplace" '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

Instances

Instances details
NoThunks (HasFS m h) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API

Methods

noThunks ∷ Context → HasFS m h → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → HasFS m h → IO (Maybe ThunkInfo) #

showTypeOfProxy (HasFS m h) → String #

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

SomeHasFSEq h ⇒ HasFS m h → SomeHasFS m 

Instances

Instances details
NoThunks (SomeHasFS m) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.FS.API

Methods

noThunks ∷ Context → SomeHasFS m → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → SomeHasFS m → IO (Maybe ThunkInfo) #

showTypeOfProxy (SomeHasFS m) → String #

hClose' ∷ (HasCallStack, Monad m) ⇒ HasFS m h → Handle h → m Bool Source #

Returns True when the handle was still open.

hGetAllMonad 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 ∷ ∀ 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

∷ ∀ 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 ∷ ∀ 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 ∷ ∀ 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 ∷ ∀ m h. (HasCallStack, Monad m) ⇒ HasFS m h → Handle h → ByteString → m Word64 Source #

This function makes sure that the whole ByteString is written.

withFile ∷ (HasCallStack, MonadThrow m) ⇒ HasFS m h → FsPathOpenMode → (Handle h → m a) → m a Source #