Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
All composes handlers in a pipeline with the same sequence. An incoming message is passed to the i'th handler, if the (i-1)'th handler has successfully processed the incoming message.
If any of these handlers returns an error, the whole transaction will be aborted, meaning that a message is either processed by all of these handlers or none of them.
Types ¶
type ComposeFunc ¶
ComposeFunc implements a single step for a ComposedHandler. At step i, the ComposedHandler calls handler i, and then invokes this function with the msg, the receiver context and the error of calling the handler (if any). The ComposeFunc in response tells the ComposedHandler how to proceed.
type ComposedHandler ¶
type ComposedHandler struct { Handlers []bh.Handler // handlers to be composed. Composer ComposeFunc // the Composer. Isolate bool // whether to isolate the dictionaries. }
ComposedHandler composes a set of handlers (ie, Handlers) using the Composer.
func (*ComposedHandler) Map ¶
func (c *ComposedHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells
Map method of the composed handler.
func (*ComposedHandler) Rcv ¶
func (c *ComposedHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error
Rcv method of the composed handler.
type Step ¶
type Step int
const ( // Continue means that the composer should continue to the next handler, // leaving the transcation open. If all handlers are already called, continue // results either in a commit if there no error, or otherwise in an abort. Continue Step = iota // Abort means that the composer should immidiately abort the transaction and // return. Abort // Commit means that the composer should immmidiately commit the transcation // and return. Commit // ContinueOrAbort acts similar to Coninue except, when there is no handlers // left, it will result in an abort. ContinueOrAbort )
func ComposeAll ¶
ComposeAll is a ComposeFunc that aborts when there is an error, and continues otherwise.
func ComposeAny ¶
ComposeAny is a ComposeFunc that Commit's when is no error, and ContinueOrAbort's if there is an error.