Documentation ¶
Overview ¶
Package mapper implements ways of splicing and mapping batches of messages so that their derivative parts can be processed individually and merged back into the original batch.
Index ¶
- func OptSetConditions(conditions []types.Condition) func(*Type)
- func OptSetLogger(l log.Modular) func(*Type)
- func OptSetOptReqMap(m map[string]string) func(*Type)
- func OptSetOptResMap(m map[string]string) func(*Type)
- func OptSetReqMap(m map[string]string) func(*Type)
- func OptSetResMap(m map[string]string) func(*Type)
- func OptSetStats(s metrics.Type) func(*Type)
- type Type
- func (t *Type) AlignResult(length int, skippedParts []int, result []types.Message) (types.Message, error)
- func (t *Type) MapRequests(payload types.Message) (types.Message, []int, error)
- func (t *Type) MapResponses(payload, response types.Message) error
- func (t *Type) TargetsProvided() []string
- func (t *Type) TargetsUsed() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptSetConditions ¶
OptSetConditions sets the conditions used by this type.
func OptSetLogger ¶
OptSetLogger sets the logger used by this type.
func OptSetOptReqMap ¶
OptSetOptReqMap sets the optional request map used by this type.
func OptSetOptResMap ¶
OptSetOptResMap sets the optional response map used by this type.
func OptSetReqMap ¶
OptSetReqMap sets the mandatory request map used by this type.
func OptSetResMap ¶
OptSetResMap sets the mandatory response map used by this type.
func OptSetStats ¶
OptSetStats sets the metrics aggregator used by this type.
Types ¶
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type contains conditions and maps for transforming a batch of messages into a subset of request messages, and mapping results from those requests back into the original message batch.
func (*Type) AlignResult ¶ added in v0.23.3
func (t *Type) AlignResult(length int, skippedParts []int, result []types.Message) (types.Message, error)
AlignResult takes the original length of a mapped payload, a slice of skipped message part indexes, and a post-mapped, post-processed slice of resuling messages, and attempts to create a new payload where the results are realigned and ready to map back into the original.
func (*Type) MapRequests ¶
MapRequests takes a single payload (of potentially multiple parts, where parts can potentially be nil) and attempts to create a new payload of mapped messages. Also returns an array of message part indexes that were skipped due to either failed conditions or being empty.
func (*Type) MapResponses ¶
MapResponses attempts to merge a batch of responses with original payloads as per the response map.
The count of parts within the response message must match the original payload. If parts were removed from the enrichment request the original contents must be interlaced back within the response object before calling the overlay.
func (*Type) TargetsProvided ¶
TargetsProvided returns a list of dot paths that this mapper provides.
func (*Type) TargetsUsed ¶
TargetsUsed returns a list of dot paths that this mapper depends on.