diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-12-13 08:34:42 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-12-13 08:34:42 +0100 |
commit | cf7cf81ea64c016e5dcc9032462624ddb4460842 (patch) | |
tree | 39d1d97aafa73bdb8ca5d290f1148b9dc9116fa1 /hosted-zone-api/src/main | |
parent | da72f32fa5bfcce81b6bcc8dbe717be0869bcc77 (diff) |
Revert "Merge pull request #20456 from vespa-engine/revert-20439-bratseth/zoneinfo-in-query-profile-context"
This reverts commit 2780822f7d1fc66ea2833b2b7aaa2b9cb74f5833, reversing
changes made to 8ff6429daf9a695f2fa5d45a8033c75fdadfcfe2.
Diffstat (limited to 'hosted-zone-api/src/main')
-rw-r--r-- | hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java index d9af2421ab9..e4b69caa940 100644 --- a/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java @@ -4,9 +4,9 @@ package ai.vespa.cloud; import java.util.Objects; /** - * Provides information about the zone in which this container is running. + * Provides information about the zone context in which this container is running. * This is available and can be injected when running in a cloud environment. - * If you don't need any other information than the zone this should be preferred + * If you don't need any other information than what's present here this should be preferred * to SystemInfo as it will never change at runtime and therefore does not * cause unnecessary reconstruction. * @@ -14,14 +14,30 @@ import java.util.Objects; */ public class ZoneInfo { + private static final ZoneInfo defaultInfo = new ZoneInfo(new ApplicationId("default", "default", "default"), + new Zone(Environment.prod, "default")); + + private final ApplicationId application; private final Zone zone; + public ZoneInfo(ApplicationId application, Zone zone) { + this.application = Objects.requireNonNull(application, "Application cannot be null!"); + this.zone = Objects.requireNonNull(zone, "Zone cannot be null!"); + } + + /** @deprecated pass an application id */ + @Deprecated // Remove on Vespa 8 public ZoneInfo(Zone zone) { - Objects.requireNonNull(zone, "Zone cannot be null!"); - this.zone = zone; + this(new ApplicationId("default", "default", "default"), zone); } + /** Returns the application this is running as part of */ + public ApplicationId application() { return application; } + /** Returns the zone this is running in */ public Zone zone() { return zone; } + /** Returns the info instance used when no zone info is available because we're not running in a cloud context */ + public static ZoneInfo defaultInfo() { return defaultInfo; } + } |