• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.libraries.mobiledatadownload.internal.experimentation;
17 
18 import com.google.common.util.concurrent.ListenableFuture;
19 import com.google.errorprone.annotations.CheckReturnValue;
20 import com.google.mobiledatadownload.internal.MetadataProto.DataFileGroupInternal;
21 import java.util.Collection;
22 
23 /** Responsible for attaching external experiment ids to log sources. */
24 @CheckReturnValue
25 public interface DownloadStageManager {
26 
27   /**
28    * Clear all set experiment ids from phenotype.
29    *
30    * <p>Note: this must be called before any metadata is cleared since this reads from metadata to
31    * learn which builds to clear.
32    */
clearAll()33   ListenableFuture<Void> clearAll();
34 
35   /**
36    * For each file group: if there are no active versions of the build, all experiment ids are
37    * removed from phenotype. If there are active versions of the build (which can happen if there
38    * are multiple variants/accounts), this will update the experiment ids to reflect the current
39    * state given that an instance of the build was removed.
40    *
41    * @param fileGroupsToClear the file groups to remove experiment ids
42    * @return a future signalling completion of the task
43    */
clearExperimentIdsForBuildsIfNoneActive( Collection<DataFileGroupInternal> fileGroupsToClear)44   ListenableFuture<Void> clearExperimentIdsForBuildsIfNoneActive(
45       Collection<DataFileGroupInternal> fileGroupsToClear);
46 
47   /**
48    * Propagates the experiment ids for {@code groupName} to phenotype. If there are multiple active
49    * builds with the given name, all experiment ids will be propagated.
50    *
51    * <p>Any failures encountered will be propagated to the returned future.
52    */
updateExperimentIds(String groupName)53   ListenableFuture<Void> updateExperimentIds(String groupName);
54 }
55