Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
Batch Operations
:: Int | Max items in a batch |
-> Maybe TimeSpec | Batch timeout |
-> ([a] -> STM ()) | Handler for complete batch |
-> IO (Batch a) | Batch with settings |
Constructs a new batcher state. If a batch timeout is configured this operation will automatically spawn a timeout handler thread. The timeout handler will automatically be killed when the batcher is garbage collected.
writeBatch :: Batch a -> a -> IO () Source #
Add a single item to the batch. The batch is automatically flushed when full.
flushBatch :: Batch a -> STM () Source #
Fires the batchHandler for the current batch from the current thread. This function is automatically called for a timeout or when buffer is filled by a write operation.
Time Utilities
fromMilliSecs :: Integer -> TimeSpec Source #
Convenience function for timeout in milliseconds.
fromMicroSecs :: Integer -> TimeSpec Source #
Highest resolution time supported by internal usage of threadDelay
.
Re-exports
TimeSpec structure
Instances
Eq TimeSpec | |
Num TimeSpec | |
Ord TimeSpec | |
Defined in System.Clock | |
Read TimeSpec | |
Show TimeSpec | |
Generic TimeSpec | |
Storable TimeSpec | |
type Rep TimeSpec | |
Defined in System.Clock type Rep TimeSpec = D1 (MetaData "TimeSpec" "System.Clock" "clock-0.7.2-ErKmPTjVISxJnEb9XKUAOs" False) (C1 (MetaCons "TimeSpec" PrefixI True) (S1 (MetaSel (Just "sec") SourceUnpack SourceStrict DecidedStrict) (Rec0 Int64) :*: S1 (MetaSel (Just "nsec") SourceUnpack SourceStrict DecidedStrict) (Rec0 Int64))) |