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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import java.time.Instant;
import java.util.Optional;
/**
* Store for the application and tester packages.
*
* This will replace ArtifactRepository for tenant applications.
*
* @author smorgrav
* @author jonmv
*/
public interface ApplicationStore {
/** Returns the tenant application package of the given version. */
byte[] get(DeploymentId deploymentId, ApplicationVersion applicationVersion);
/** Returns the application package diff, compared to the previous build, for the given tenant, application and build number */
Optional<byte[]> getDiff(TenantName tenantName, ApplicationName applicationName, long buildNumber);
/** Removes diffs for packages before the given build number */
void pruneDiffs(TenantName tenantName, ApplicationName applicationName, long beforeBuildNumber);
/** Find prod application package by given build number */
Optional<byte[]> find(TenantName tenant, ApplicationName application, long buildNumber);
/** Whether the prod application package with the given number is stored. */
default boolean hasBuild(TenantName tenant, ApplicationName application, long buildNumber) {
return find(tenant, application, buildNumber).isPresent();
}
/** Stores the given tenant application package of the given version and diff since previous version. */
void put(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] applicationPackage, byte[] diff);
/** Removes applications older than the given version, for the given application, and returns whether something was removed. */
boolean prune(TenantName tenant, ApplicationName application, ApplicationVersion olderThanVersion);
/** Removes all application packages for the given application, including any development package. */
void removeAll(TenantName tenant, ApplicationName application);
/** Returns the tester application package of the given version. Does NOT contain the services.xml. */
byte[] getTester(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion);
/** Stores the given tester application package of the given version. Does NOT contain the services.xml. */
void putTester(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] testerPackage);
/** Removes tester packages older than the given version, for the given tester, and returns whether something was removed. */
boolean pruneTesters(TenantName tenant, ApplicationName application, ApplicationVersion olderThanVersion);
/** Removes all tester packages for the given tester. */
void removeAllTesters(TenantName tenant, ApplicationName application);
/** Returns the application package diff, compared to the previous build, for the given deployment and build number */
Optional<byte[]> getDevDiff(DeploymentId deploymentId, long buildNumber);
/** Removes diffs for dev packages before the given build number */
void pruneDevDiffs(DeploymentId deploymentId, long beforeBuildNumber);
/** Stores the given application package as the development package for the given deployment and version and diff since previous version. */
void putDev(DeploymentId deploymentId, ApplicationVersion version, byte[] applicationPackage, byte[] diff);
/** Stores the given application meta data with the current time as part of the path. */
void putMeta(TenantName tenant, ApplicationName application, Instant now, byte[] metaZip);
/** Marks the given application as deleted, and eligible for meta data GC at a later time. */
void putMetaTombstone(TenantName tenant, ApplicationName application, Instant now);
/** Stores the given manual deployment meta data with the current time as part of the path. */
void putMeta(DeploymentId id, Instant now, byte[] metaZip);
/** Marks the given manual deployment as deleted, and eligible for meta data GC at a later time. */
void putMetaTombstone(DeploymentId id, Instant now);
/** Prunes meta data such that only what was active at the given instant, and anything newer, is retained. */
void pruneMeta(Instant oldest);
}
|