hinotify-conduit-0.1.0.1: inotify conduit sources
Safe HaskellNone
LanguageHaskell2010

Data.Conduit.INotify

Synopsis

Documentation

inotifyEventsSource Source #

Arguments

:: (MonadResource m, Monad m) 
=> INotify

INotify

-> NonEmpty EventVariety

events to watch for

-> FilePath

path to file to be watched

-> STM (ConduitT () Event m (), STM ())

returns (source, handle to terminate the watch)

Watch INotify events for given file Does not support file rotation. Once the watched file is removed, it will not emit any additional events and needs to be terminated via handle.

sourceHandleEof :: MonadIO m => Handle -> ConduitT () (Maybe ByteString) m () Source #

Stream contents of a Handle as binary data and yield Nothing after EOF is reached

sourceFileFollowModify Source #

Arguments

:: (MonadResource m, MonadIO m) 
=> INotify

INotify

-> FilePath

path to file to be followed

-> STM (ConduitT () (Maybe ByteString) m (), STM ())

returns (source of binary data from file, handle to terminate the follow)

Stream contents of a file as binary data. Once EOF is reached it waits for file modifications and streams data as they are appended to the file. Once the watch is terminated, it will read the file until EOF is reached.

Source emits Nothing when EOF is reached. For version emitting just data see 'sourceFileFollowModify'' Does not support file rotations. For version supporing rotations see sourceFileFollowModifyRotateWithSeek

sourceFileFollowModify' :: (MonadResource m, MonadIO m) => INotify -> FilePath -> STM (ConduitT () ByteString m (), STM ()) Source #

Version of sourceFileFollowModify not notifying about EOF

replacableBracketP Source #

Arguments

:: MonadResource m 
=> IO a

acquire resource computation

-> (a -> IO ())

release resource computation

-> ((m a, m ()) -> ConduitT i o m ())

computation to run in-between. | first: acquires the resource if not available, otherwise just gets it | second: releases the resource

-> ConduitT i o m () 

Like bracketP, but resource can be released within 'in-between' computation. Resource is recreated after release if needed

inotifyEventsSourceRotate :: MonadResource m => INotify -> NonEmpty EventVariety -> FilePath -> STM (ConduitT () Event m (), STM ()) Source #

Watch INotify events for given file. Interprets file removal as file rotation and tries to recreate the watch again.

sourceFileFollowModifyRotateWithSeek Source #

Arguments

:: (MonadResource m, MonadIO m) 
=> INotify

INotify

-> FilePath

path to parent directory

-> FilePath

file name relative to parent directory

-> STM (ConduitT () (Maybe ByteString) m (), STM ())

(source, handle to terminate the watch)

Stream contents of a file as binary data. Once EOF is reached it waits for file modifications and streams data as they are appended to the file. Once the watch is terminated, it will read the file until EOF is reached.

Interprets file removal as file rotation and tries to recreate the watch and continue to follow the file from last position (expects just rotation that resembles append to file). Source emits Nothing when EOF is reached. For version emitting just data see 'sourceFileFollowModifyRotateWithSeek''

Since the handle prevents the file from deleting, it is watching a parent directory for MoveIn events and interprets them as rotations

sourceFileFollowModifyRotateWithSeek' Source #

Arguments

:: (MonadResource m, MonadIO m) 
=> INotify

INotify

-> FilePath

path to parent directory

-> FilePath

file name relative to parent directory

-> STM (ConduitT () ByteString m (), STM ())

(source, handle to terminate the watch)

Version of sourceFileFollowModifyRotateWithSeek not notifying about EOF

sourceFileFollowModifyRotateWithSeekIO Source #

Arguments

:: (MonadResource m, MonadIO m) 
=> INotify

INotify

-> FilePath

file name

-> IO (ConduitT () (Maybe ByteString) m (), STM ())

(source, handle to terminate the watch)

Version of sourceFileFollowModifyRotateWithSeek that determines parent directory

sourceFileFollowModifyRotateWithSeekIO' Source #

Arguments

:: (MonadResource m, MonadIO m) 
=> INotify

INotify

-> FilePath

file name

-> IO (ConduitT () ByteString m (), STM ())

(source, handle to terminate the watch)

Version of 'sourceFileFollowModifyRotateWithSeek'' that determines parent directory