• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
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 
17 package com.android.adservices.service.stats;
18 
19 import com.google.auto.value.AutoValue;
20 
21 /** Class for recording Custom Audience Update stats when a scheduled update is performed. */
22 @AutoValue
23 public abstract class ScheduledCustomAudienceUpdatePerformedStats {
24 
25     /** Returns the number of partial Custom Audiences in the update request. */
getNumberOfPartialCustomAudienceInRequest()26     public abstract int getNumberOfPartialCustomAudienceInRequest();
27 
28     /** Returns the number of leave Custom Audience operations in the update request. */
getNumberOfLeaveCustomAudienceInRequest()29     public abstract int getNumberOfLeaveCustomAudienceInRequest();
30 
31     /** Returns the number of join Custom Audience operations in the update response. */
getNumberOfJoinCustomAudienceInResponse()32     public abstract int getNumberOfJoinCustomAudienceInResponse();
33 
34     /** Returns the number of leave Custom Audience operations in the update response. */
getNumberOfLeaveCustomAudienceInResponse()35     public abstract int getNumberOfLeaveCustomAudienceInResponse();
36 
37     /** Returns the number of Custom Audiences successfully joined during the update. */
getNumberOfCustomAudienceJoined()38     public abstract int getNumberOfCustomAudienceJoined();
39 
40     /** Returns the number of Custom Audiences successfully left during the update. */
getNumberOfCustomAudienceLeft()41     public abstract int getNumberOfCustomAudienceLeft();
42 
43     /** Returns whether this update was the initial hop in the scheduled updates. */
getWasInitialHop()44     public abstract boolean getWasInitialHop();
45 
46     /** Returns the number of scheduled updates received in the update response. */
getNumberOfScheduleUpdatesInResponse()47     public abstract int getNumberOfScheduleUpdatesInResponse();
48 
49     /** Returns the number of updates successfully scheduled during this update. */
getNumberOfUpdatesScheduled()50     public abstract int getNumberOfUpdatesScheduled();
51 
52     /**
53      * Returns a new builder for creating an instance of {@link
54      * ScheduledCustomAudienceUpdatePerformedStats}.
55      */
builder()56     public static Builder builder() {
57         return new AutoValue_ScheduledCustomAudienceUpdatePerformedStats.Builder()
58                 .setWasInitialHop(true)
59                 .setNumberOfScheduleUpdatesInResponse(0)
60                 .setNumberOfUpdatesScheduled(0)
61                 .setNumberOfLeaveCustomAudienceInRequest(0);
62     }
63 
64     /** Builder for {@link ScheduledCustomAudienceUpdatePerformedStats} objects. */
65     @AutoValue.Builder
66     public abstract static class Builder {
67         /** Sets the number of partial Custom Audiences in the update request. */
setNumberOfPartialCustomAudienceInRequest(int value)68         public abstract Builder setNumberOfPartialCustomAudienceInRequest(int value);
69 
70         /** Sets the number of leave Custom Audience operations in the update request. */
setNumberOfLeaveCustomAudienceInRequest(int value)71         public abstract Builder setNumberOfLeaveCustomAudienceInRequest(int value);
72 
73         /** Sets the number of join Custom Audience operations in the update response. */
setNumberOfJoinCustomAudienceInResponse(int value)74         public abstract Builder setNumberOfJoinCustomAudienceInResponse(int value);
75 
76         /** Sets the number of leave Custom Audience operations in the update response. */
setNumberOfLeaveCustomAudienceInResponse(int value)77         public abstract Builder setNumberOfLeaveCustomAudienceInResponse(int value);
78 
79         /** Sets the number of Custom Audiences successfully joined during the update. */
setNumberOfCustomAudienceJoined(int value)80         public abstract Builder setNumberOfCustomAudienceJoined(int value);
81 
82         /** Sets the number of Custom Audiences successfully left during the update. */
setNumberOfCustomAudienceLeft(int value)83         public abstract Builder setNumberOfCustomAudienceLeft(int value);
84 
85         /** Sets whether this update was the initial hop in a chain of scheduled updates. */
setWasInitialHop(boolean value)86         public abstract Builder setWasInitialHop(boolean value);
87 
88         /** Sets the number of scheduled updates received in the update response. */
setNumberOfScheduleUpdatesInResponse(int value)89         public abstract Builder setNumberOfScheduleUpdatesInResponse(int value);
90 
91         /** Sets the number of updates successfully scheduled during this update. */
setNumberOfUpdatesScheduled(int value)92         public abstract Builder setNumberOfUpdatesScheduled(int value);
93 
94         /**
95          * Returns a new {@link ScheduledCustomAudienceUpdatePerformedStats} instance built from the
96          * values set on this builder.
97          */
build()98         public abstract ScheduledCustomAudienceUpdatePerformedStats build();
99     }
100 }
101