Packmatic.Event (Packmatic v1.1.2) View Source
Represents Events that can be raised during the lifecycle of a Packmatic Stream being consumed.
To listen for Events, you must pass a function reference to the
on_event: option when calling
Packmatic.build_stream/2. This function will be called at appropriate junctures in the
lifecycle of a Stream being consumed.
The Events will be called in the following order:
Packmatic.Event.StreamStarted: Sent when the Stream starts encoding.
Packmatic.Event.EntryStarted: Sent when the Stream starts encoding data for a new entry.
Packmatic.Event.EntryFailed: Sent when the entry has failed to initialise (its Source returned an error during
Packmatic.Source.init/1), in which case there would have been no
EntryUpdatedevents, or when the entry has failed during the course of reading (its Source returned an error during
Packmatic.Event.EntryCompleted: Sent when the entry has been fully encoded (its Source has returned EOF).
Packmatic.Event.StreamEnded: Sent when the Stream has completed journaling.
Please note that more event types may be added in the future.
Link to this section Summary
Link to this section Types
Represents an Event that will be passed to the handler.
Represents the callback function passed to the Encoder.
Please keep in mind that more events may be added in the future, so you should always include a fallback clause in your handler function.
Handlers are called from the same process that the Stream is being iterated from, which allows
you to control what happens to it. Should you not wish to interrupt the Encoder, return
Otherwise, if you must, you may raise an exception, which will crash the Stream.