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

Data.Conduit.INotify

Synopsis

Documentation

withINotify :: MonadResource m => (INotify -> ConduitT a b m r) -> ConduitT a b m r Source #

Run ConduitT with INotify

inotifyEventsSource Source #

Arguments

:: (MonadResource m, Monad m) 
=> [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. Will yield Nothing after EOF is reached

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

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) => FilePath -> STM (ConduitT () ByteString m (), STM ()) Source #

Version of sourceFileFollowModify not notifying about EOF

replacableBracketP :: MonadResource m => IO a -> (a -> IO ()) -> ((m a, m ()) -> ConduitT i o m ()) -> ConduitT i o m () Source #

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

inotifyEventsSourceRotate :: MonadResource m => [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 :: (MonadResource m, MonadIO m) => FilePath -> STM (ConduitT () (Maybe ByteString) m (), STM ()) Source #

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