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

com.yahoo.vespa.configserver.flags.db.ZooKeeperFlagSource Maven / Gradle / Ivy

There is a newer version: 8.444.18
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.configserver.flags.db;

import com.yahoo.vespa.configserver.flags.FlagsDb;
import com.yahoo.vespa.flags.FetchVector;
import com.yahoo.vespa.flags.FlagId;
import com.yahoo.vespa.flags.FlagSource;
import com.yahoo.vespa.flags.RawFlag;

import java.util.Optional;

/**
 * @author hakonhall
 */
public class ZooKeeperFlagSource implements FlagSource {

    private final FlagsDb flagsDb;

    public ZooKeeperFlagSource(FlagsDb flagsDb) {
        this.flagsDb = flagsDb;
    }

    @Override
    public Optional fetch(FlagId id, FetchVector vector) {
        return flagsDb.getValue(id).flatMap(data -> data.resolve(vector));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy