Class ReductionDataCollector<T extends ReductionData>

    • Constructor Detail

      • ReductionDataCollector

        protected ReductionDataCollector()
    • Method Detail

      • submitReservations

        public abstract void submitReservations​(Consumer<ReductionDataReservation<?,​?>> consumer)
        Submits the data reservations needed for this data collector.
        Parameters:
        consumer - the consumer which the reservations are submitted to
      • newData

        public abstract T newData()
        A clean slate to start a new reduction.
        Returns:
        the new reduction data
      • addLastingCollectTarget

        public void addLastingCollectTarget​(ReductionData data)
        Add a reduction data to target during collection. The given target is valid until the lasting targets are cleared.
        Parameters:
        data - the data to target
      • clearLastingCollectTargets

        public void clearLastingCollectTargets()
        Clear the lasting collection targets. After this is called the current lasting targets will not be affected by future collectAndApply() calls.
      • newDataTarget

        public T newDataTarget()
        Create a new reduction data to target during collection. The given target is only valid for one call to collectAndApply().
        Returns:
        the reduction data created
      • addCollectTarget

        public void addCollectTarget​(ReductionData data)
        Add a reduction data to target during collection. The given target is only valid for one call to collectAndApply().
        Parameters:
        data - the data to target
      • collectAndApply

        public void collectAndApply()
        Collect the info for the current Solr Document and apply the results to the given collection targets.

        After application, all non-lasting targets are removed.

      • collect

        protected void collect()
        Collect the information from current Solr Document.
      • apply

        protected abstract void apply​(T data)
        Apply the collected info to the given reduction data. Should always be called after a collect() call.
        Parameters:
        data - reduction data to apply collected info to
      • newDataIO

        public T newDataIO()
        Create a new reduction data to use in exporting and merging.
        Returns:
        the created reduction data
      • dataIO

        public void dataIO​(ReductionData data)
        Set the reduction data to use in exporting and merging.
        Parameters:
        data - the data to use
      • setMergedData

        public abstract void setMergedData​(ReductionData data)
        Finalize the reduction with the merged data stored in the parameter. Once the reduction is finalized, the ReductionFunctions that use this data collector act like regular AnalyticsValue classes that can be accessed through their get<value-type> methods.

        (FOR CLOUD)

        Parameters:
        data - the merged data to compute a reduction for
      • setData

        public abstract void setData​(ReductionData data)
        Finalize the reduction with the collected data stored in the parameter. Once the reduction is finalized, the ReductionFunctions that use this data collector act like regular AnalyticsValue classes that can be accessed through their get<value-type> methods.

        (FOR SINGLE-SHARD)

        Parameters:
        data - the collected data to compute a reduction for
      • getName

        public abstract String getName()
        Get the name of the reduction data collector. This is the same across all instances of the data collector.
        Returns:
        the name
      • getExpressionStr

        public abstract String getExpressionStr()
        The unique expression string of the reduction data collector, given all inputs and parameters. Used during ReductionDataCollector syncing. Since the string should be unique, only one of expression is kept.
        Returns:
        the expression string