lukko-0.1.1.3: File locking

Safe Haskell | Safe
Language | Haskell2010

Lukko.NoOp

Contents

- Types
- File descriptors
- Handles

Description

Non-operating locks.

All functions throw `FileLockingNotImplemented`.

Synopsis

- data FileLockingNotSupported = FileLockingNotSupported
- fileLockingSupported :: Bool
- type FileLockingSupported = 'False
- data FileLockingMethod
  - = MethodOFD
  - | MethodFLock
  - | MethodWindows
  - | MethodNoOp
- fileLockingMethod :: FileLockingMethod
- data LockMode
  - = SharedLock
  - | ExclusiveLock
- data FD
- fdOpen :: FilePath -> IO FD
- fdClose :: FD -> IO ()
- fdLock :: FD -> LockMode -> IO ()
- fdTryLock :: FD -> LockMode -> IO Bool
- fdUnlock :: FD -> IO ()
- hLock :: Handle -> LockMode -> IO ()
- hTryLock :: Handle -> LockMode -> IO Bool
- hUnlock :: Handle -> IO ()

# Types

data FileLockingNotSupported Source #

Exception thrown by `hLock` on non-Windows platforms that don't support `flock`.

Constructors

FileLockingNotSupported |

#### Instances

Instances details

Exception FileLockingNotSupported Source # |
Instance details Defined in Lukko.Internal.Types Methods toException :: FileLockingNotSupported -> SomeException Source # fromException :: SomeException -> Maybe FileLockingNotSupported Source # displayException :: FileLockingNotSupported -> String Source #
Show FileLockingNotSupported Source # |
Instance details Defined in Lukko.Internal.Types Methods showsPrec :: Int -> FileLockingNotSupported -> ShowS Source # show :: FileLockingNotSupported -> String Source # showList :: [FileLockingNotSupported] -> ShowS Source #

fileLockingSupported :: Bool Source #

A constants specifying whether file locking is supported.

type FileLockingSupported = 'False Source #

A type level `fileLockingSupported`.

data FileLockingMethod Source #

Potentially availble lock methods.

Constructors

MethodOFD | open file descriptor locking
MethodFLock | BSD `flock`
MethodWindows | Windows locking
MethodNoOp | No-Op (throws `FileLockingNotSupported`)

#### Instances

Instances details

Bounded FileLockingMethod Source # |
Instance details Defined in Lukko.Internal.Types Methods minBound :: FileLockingMethod Source # maxBound :: FileLockingMethod Source #
Enum FileLockingMethod Source # |

Instance details

Defined in Lukko.Internal.Types

Methods

succ :: FileLockingMethod -> FileLockingMethod Source #

pred :: FileLockingMethod -> FileLockingMethod Source #

toEnum :: Int -> FileLockingMethod Source #

fromEnum :: FileLockingMethod -> Int Source #

enumFrom :: FileLockingMethod -> [FileLockingMethod] Source #

enumFromThen :: FileLockingMethod -> FileLockingMethod -> [FileLockingMethod] Source #

enumFromTo :: FileLockingMethod -> FileLockingMethod -> [FileLockingMethod] Source #

enumFromThenTo :: FileLockingMethod -> FileLockingMethod -> FileLockingMethod -> [FileLockingMethod] Source #

Show FileLockingMethod Source # |
Instance details Defined in Lukko.Internal.Types Methods showsPrec :: Int -> FileLockingMethod -> ShowS Source # show :: FileLockingMethod -> String Source # showList :: [FileLockingMethod] -> ShowS Source #
Eq FileLockingMethod Source # |
Instance details Defined in Lukko.Internal.Types Methods (==) :: FileLockingMethod -> FileLockingMethod -> Bool Source # (/=) :: FileLockingMethod -> FileLockingMethod -> Bool Source #
Ord FileLockingMethod Source # |

Instance details

Defined in Lukko.Internal.Types

Methods

compare :: FileLockingMethod -> FileLockingMethod -> Ordering Source #

(<) :: FileLockingMethod -> FileLockingMethod -> Bool Source #

(<=) :: FileLockingMethod -> FileLockingMethod -> Bool Source #

(>) :: FileLockingMethod -> FileLockingMethod -> Bool Source #

(>=) :: FileLockingMethod -> FileLockingMethod -> Bool Source #

max :: FileLockingMethod -> FileLockingMethod -> FileLockingMethod Source #

min :: FileLockingMethod -> FileLockingMethod -> FileLockingMethod Source #

fileLockingMethod :: FileLockingMethod Source #

A constant specifying this method

data LockMode Source #

Indicates a mode in which a file should be locked.

Constructors

SharedLock |
ExclusiveLock |

# File descriptors

data FD Source #

Opaque file descriptor

This is a wrapper over `CInt`

fdOpen :: FilePath -> IO FD Source #

Open file to be used for locking.

    open(path, O_RDWR | O_CREAT);

fdClose :: FD -> IO () Source #

Close lock file.

    close(fd);

fdLock :: FD -> LockMode -> IO () Source #

No-op implementation.

fdTryLock :: FD -> LockMode -> IO Bool Source #

No-op implementation

fdUnlock :: FD -> IO () Source #

No-op implementation.

# Handles

hLock :: Handle -> LockMode -> IO () Source #

No-op implementation.

hTryLock :: Handle -> LockMode -> IO Bool Source #

No-op implementation

hUnlock :: Handle -> IO () Source #

No-op implementation.