blob: 50601978bbaf90f0c4808eb811491944a11f5b08 (
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
|
// 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.provisioning;
import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.flags.FetchVector;
import com.yahoo.vespa.flags.FlagSource;
import com.yahoo.vespa.flags.Flags;
import com.yahoo.vespa.flags.PermanentFlags;
import com.yahoo.vespa.flags.custom.SharedHost;
/**
* Miscellaneous constants used while preparing an allocation for a cluster.
*
* <p>Typically used to access feature flags that must be evaluated once at the start of the preparation,
* to avoid inconsistencies if evaluated multiple times during.</p>
*
* @author hakonhall
*/
public record AllocationParams(boolean makeExclusive, SharedHost sharedHost) {
public static AllocationParams from(FlagSource flagSource, ApplicationId application, Version version) {
return new AllocationParams(Flags.MAKE_EXCLUSIVE.bindTo(flagSource)
.with(FetchVector.Dimension.TENANT_ID, application.tenant().value())
.with(FetchVector.Dimension.INSTANCE_ID, application.serializedForm())
.with(FetchVector.Dimension.VESPA_VERSION, version.toFullString())
.value(),
PermanentFlags.SHARED_HOST.bindTo(flagSource).value());
}
}
|