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

Ouroboros.Consensus.Storage.FS.API.Types

Synopsis

Modes

data SeekMode Source #

A mode that determines the effect of hSeek hdl mode i .

Constructors

AbsoluteSeek

the position of hdl is set to i .

RelativeSeek

the position of hdl is set to offset i from the current position.

SeekFromEnd

the position of hdl is set to offset i from the end of the file.

Instances

Instances details
Enum SeekMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.Device

Eq SeekMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.Device

Ord SeekMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.Device

Read SeekMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.Device

Show SeekMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.Device

Ix SeekMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.Device

Condense SeekMode Source #
Instance details

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

Paths

newtype MountPoint Source #

Mount point

FsPath s are not absolute paths, but must be interpreted with respect to a particualar mount point.

fsPathInit :: HasCallStack => FsPath -> FsPath Source #

Drop the final component of the path

Undefined if the path is empty.

fsPathSplit :: FsPath -> Maybe ( FsPath , Text ) Source #

Split FsPath is essentially (init fp, last fp)

Like init and last , Nothing if empty.

mkFsPath :: [ String ] -> FsPath Source #

Constructor for FsPath ensures path is in normal form

opaque

data FsPath Source #

Instances

Instances details
Eq FsPath Source #
Instance details

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

Ord FsPath Source #
Instance details

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

Show FsPath Source #
Instance details

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

Generic FsPath Source #
Instance details

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

NoThunks FsPath Source #
Instance details

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

Condense FsPath Source #
Instance details

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

type Rep FsPath Source #
Instance details

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

type Rep FsPath = D1 (' MetaData "FsPath" "Ouroboros.Consensus.Storage.FS.API.Types" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" ' True ) ( C1 (' MetaCons "UnsafeFsPath" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "fsPathToList") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ Text ])))

Handles

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 )))

Offset

newtype AbsOffset Source #

Instances

Instances details
Bounded AbsOffset Source #
Instance details

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

Enum AbsOffset Source #
Instance details

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

Eq AbsOffset Source #
Instance details

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

Num AbsOffset Source #
Instance details

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

Ord AbsOffset Source #
Instance details

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

Show AbsOffset Source #
Instance details

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

Errors

data FsError Source #

Constructors

FsError

Fields

data FsErrorPath Source #

For better error reporting to the end user, we want to include the mount point of the file. But the mountpoint may not always be available, like when we mock the fs or we simulate fs errors.

sameFsError :: FsError -> FsError -> Bool Source #

Check if two errors are semantically the same error

This ignores the error string, the errno, and the callstack.

From IOError to FsError

ioToFsError :: HasCallStack => FsErrorPath -> IOError -> FsError Source #

Translate exceptions thrown by IO functions to FsError

We take the FsPath as an argument. We could try to translate back from a FilePath to an FsPath (given a MountPoint ), but we know the FsPath at all times anyway and not all IO exceptions actually include a filepath.

ioToFsErrorType :: IOError -> FsErrorType Source #

Assign an FsErrorType to the given IOError .

Note that we don't always use the classification made by errnoToIOError (also see Error ) because it combines some errors into one IOErrorType , e.g., EMFILE (too many open files) and ENOSPC (no space left on device) both result in ResourceExhausted while we want to keep them separate. For this reason, we do a classification of our own based on the errno while sometimes deferring to the existing classification.

See the ERRNO(3) man page for the meaning of the different errnos.

Orphan instances