ARCcore.discriminator provides a software factory that accepts an array of ARCcore.filter objects (minimum of two) and produces another filter object that routes its request data to 1:N of the original filters provided to the factory. Or, it rejects the message as non-routable.
The ARCcore.discriminator filter factory internally leverages ARCcore.graph to merge the input filter specifications of the N input filters and deduce the minimum number of empirical namespace and type checks that must be performed in order to "discriminate" an incoming request. This deduced set of checks is performed at run-time.
Instances of discriminator
are relatively expensive to construct for large sets of complex input filters
given that the input filter specifications must be merged and analyzed via a graph coloring algorithm.
But, run time overhead is minimal because all of this static analysis is performed in the filter factory
at construction time.
$ node
> const arccore = require('arccore');
undefined
> arccore.discriminator
{ create: [Function] }
>