io.split.client.YamlLocalhostSplitChangeFetcher Maven / Gradle / Ivy
package io.split.client;
import io.split.client.dtos.Condition;
import io.split.client.dtos.ConditionType;
import io.split.client.dtos.Split;
import io.split.client.dtos.SplitChange;
import io.split.client.dtos.Status;
import io.split.client.utils.InputStreamProvider;
import io.split.client.utils.LocalhostConstants;
import io.split.engine.common.FetchOptions;
import io.split.engine.experiments.SplitChangeFetcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static io.split.client.utils.LocalhostSanitizer.createCondition;
public class YamlLocalhostSplitChangeFetcher implements SplitChangeFetcher {
private static final Logger _log = LoggerFactory.getLogger(YamlLocalhostSplitChangeFetcher.class);
private final InputStreamProvider _inputStreamProvider;
public YamlLocalhostSplitChangeFetcher(InputStreamProvider inputStreamProvider) {
_inputStreamProvider = inputStreamProvider;
}
@Override
public SplitChange fetch(long since, FetchOptions options) {
try {
Yaml yaml = new Yaml();
List