Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- withINotify :: MonadResource m => (INotify -> ConduitT a b m r) -> ConduitT a b m r
- inotifyEventsSource :: (MonadResource m, Monad m) => [EventVariety] -> FilePath -> STM (ConduitT () Event m (), STM ())
- sourceHandleEof :: MonadIO m => Handle -> ConduitT () (Maybe ByteString) m ()
- sourceFileFollowModify :: (MonadResource m, MonadIO m) => FilePath -> STM (ConduitT () (Maybe ByteString) m (), STM ())
- sourceFileFollowModify' :: (MonadResource m, MonadIO m) => FilePath -> STM (ConduitT () ByteString m (), STM ())
- replacableBracketP :: MonadResource m => IO a -> (a -> IO ()) -> ((m a, m ()) -> ConduitT i o m ()) -> ConduitT i o m ()
- inotifyEventsSourceRotate :: MonadResource m => [EventVariety] -> FilePath -> STM (ConduitT () Event m (), STM ())
- data FollowFileEvent
- sourceFileFollowModifyRotateWithSeek :: (MonadResource m, MonadIO m) => FilePath -> STM (ConduitT () (Maybe ByteString) m (), STM ())
- sourceFileFollowModifyRotateWithSeek' :: (MonadResource m, MonadIO m) => FilePath -> STM (ConduitT () ByteString m (), STM ())
Documentation
withINotify :: MonadResource m => (INotify -> ConduitT a b m r) -> ConduitT a b m r Source #
Run ConduitT
with INotify
:: (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.
data FollowFileEvent Source #
Instances
Eq FollowFileEvent Source # | |
Defined in Data.Conduit.INotify (==) :: FollowFileEvent -> FollowFileEvent -> Bool # (/=) :: FollowFileEvent -> FollowFileEvent -> Bool # | |
Show FollowFileEvent Source # | |
Defined in Data.Conduit.INotify showsPrec :: Int -> FollowFileEvent -> ShowS # show :: FollowFileEvent -> String # showList :: [FollowFileEvent] -> ShowS # |
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''
sourceFileFollowModifyRotateWithSeek' :: (MonadResource m, MonadIO m) => FilePath -> STM (ConduitT () ByteString m (), STM ()) Source #
Version of sourceFileFollowModifyRotateWithSeek
not notifying about EOF