All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kolibrifx.plovercrest.server.folds.FoldCombinators Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
 */

package com.kolibrifx.plovercrest.server.folds;

import com.kolibrifx.plovercrest.server.streams.folds.HistoricalCombinatorStrategy;
import com.kolibrifx.plovercrest.server.streams.folds.LiveCombinatorStrategy;

public final class FoldCombinators {
    private FoldCombinators() {
    }

    /**
     * Returns a {@link FoldCombinator} suited for live data. It will produce new combinations as
     * long as any of the inputs are updated. A live combinator should not be active when importing
     * historical data to one of its input tables.
     * 

* This combinator will repeatedly pick the earliest timestamp from each input feed to produce * combinations. It will keep producing combinations until all of the inputs have run out * of data. *

* For instance, given two input tables A and B with the following timestamps: *

    *
  1. A: 10, 30
  2. *
  3. B: 20, 40
  4. *
*

* Will produce the following combinations: *

    *
  1. (A:10, B:20)
  2. *
  3. (A:30, B:20)
  4. *
  5. (A:30, B:40)
  6. *
*

* If input A now receives two new elements with timestamps 35 and 45, the next * combinations are: *

    *
  1. (A:35, B:40) *
  2. (A:45, B:40) *
*/ public static FoldCombinator live() { return new LiveCombinatorStrategy(); } /** * Returns a {@link FoldCombinator} suited for historical data. This guarantees that the fold * receives all timestamps in order across tables, at the cost of potential delays when one or * more of the inputs run out of data. *

* This combinator will repeatedly pick the earliest timestamp from each input feed to produce * combinations. As soon as one of the inputs run out of elements, it will stop producing * combinations. *

* For instance, given two input tables A and B with the following timestamps: *

    *
  1. A: 10, 30
  2. *
  3. B: 20, 40
  4. *
*

* Will produce the following combinations: *

    *
  1. (A:10, B:20)
  2. *
  3. (A:30, B:20)
  4. *
*

* The combination (A:30, B:40) is not generated (yet) since this can break the timestamp * order guarantee. If input A now receives two new elements with timestamps 35 and 45, * the next combinations are: *

    *
  1. (A:35, B:20) *
  2. (A:35, B:40) *
*/ public static FoldCombinator historical() { return new HistoricalCombinatorStrategy(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy