blob: 966005817bb4508befe37cec76026589b2cad7e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.lb;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.hosted.provision.persistence.CuratorDb;
import java.util.function.Predicate;
/**
* The load balancers of this node repo.
*
* @author bratseth
* @author mpolden
*/
public class LoadBalancers {
private final CuratorDb db;
public LoadBalancers(CuratorDb db) {
this.db = db;
}
/** Returns a filterable list of all load balancers in this repository */
public LoadBalancerList list() {
return list((ignored) -> true);
}
/** Returns a filterable list of load balancers belonging to given application */
public LoadBalancerList list(ApplicationId application) {
return list((id) -> id.application().equals(application));
}
private LoadBalancerList list(Predicate<LoadBalancerId> predicate) {
return LoadBalancerList.copyOf(db.readLoadBalancers(predicate).values());
}
}
|