@@ -47,7 +47,7 @@ public class Bucketer {
4747
4848 private final ProjectConfig projectConfig ;
4949
50- @ Nullable private final UserExperimentRecord userExperimentRecord ;
50+ @ Nullable private final UserProfile userProfile ;
5151
5252 private static final Logger logger = LoggerFactory .getLogger (Bucketer .class );
5353
@@ -63,9 +63,9 @@ public Bucketer(ProjectConfig projectConfig) {
6363 this (projectConfig , null );
6464 }
6565
66- public Bucketer (ProjectConfig projectConfig , @ Nullable UserExperimentRecord userExperimentRecord ) {
66+ public Bucketer (ProjectConfig projectConfig , @ Nullable UserProfile userProfile ) {
6767 this .projectConfig = projectConfig ;
68- this .userExperimentRecord = userExperimentRecord ;
68+ this .userProfile = userProfile ;
6969 }
7070
7171 private String bucketToEntity (int bucketValue , List <TrafficAllocation > trafficAllocations ) {
@@ -112,12 +112,12 @@ private Variation bucketToVariation(@Nonnull Experiment experiment,
112112 String experimentKey = experiment .getKey ();
113113 String combinedBucketId = userId + experimentId ;
114114
115- // If a user experiment record instance is present then check it for a saved variation
116- if (userExperimentRecord != null ) {
117- String variationKey = userExperimentRecord .lookup (userId , experimentKey );
115+ // If a user profile instance is present then check it for a saved variation
116+ if (userProfile != null ) {
117+ String variationKey = userProfile .lookup (userId , experimentKey );
118118 if (variationKey != null ) {
119119 logger .info ("Returning previously activated variation \" {}\" of experiment \" {}\" "
120- + "for user \" {}\" from user experiment record ." ,
120+ + "for user \" {}\" from user profile ." ,
121121 variationKey , experimentKey , userId );
122122 // A variation is stored for this combined bucket id
123123 return projectConfig
@@ -127,7 +127,7 @@ private Variation bucketToVariation(@Nonnull Experiment experiment,
127127 .get (variationKey );
128128 } else {
129129 logger .info ("No previously activated variation of experiment \" {}\" "
130- + "for user \" {}\" found in user experiment record ." ,
130+ + "for user \" {}\" found in user profile ." ,
131131 experimentKey , userId );
132132 }
133133 }
@@ -145,9 +145,9 @@ private Variation bucketToVariation(@Nonnull Experiment experiment,
145145 logger .info ("User \" {}\" is in variation \" {}\" of experiment \" {}\" ." , userId , variationKey ,
146146 experimentKey );
147147
148- // If a user experiment record is present give it a variation to store
149- if (userExperimentRecord != null ) {
150- boolean saved = userExperimentRecord .save (userId , experiment .getKey (), variationKey );
148+ // If a user profile is present give it a variation to store
149+ if (userProfile != null ) {
150+ boolean saved = userProfile .save (userId , experiment .getKey (), variationKey );
151151 if (saved ) {
152152 logger .info ("Saved variation \" {}\" of experiment \" {}\" for user \" {}\" ." ,
153153 variationKey , experimentKey , userId );
@@ -224,23 +224,23 @@ int generateBucketValue(int hashCode) {
224224 }
225225
226226 @ Nullable
227- public UserExperimentRecord getUserExperimentRecord () {
228- return userExperimentRecord ;
227+ public UserProfile getUserProfile () {
228+ return userProfile ;
229229 }
230230
231231 /**
232- * Gives implementations of {@link UserExperimentRecord } a chance to remove records
232+ * Gives implementations of {@link UserProfile } a chance to remove records
233233 * of experiments that are deleted or not running.
234234 */
235- public void cleanUserExperimentRecords () {
236- if (userExperimentRecord != null ) {
237- Map <String , Map <String ,String >> records = userExperimentRecord .getAllRecords ();
235+ public void cleanUserProfiles () {
236+ if (userProfile != null ) {
237+ Map <String , Map <String ,String >> records = userProfile .getAllRecords ();
238238 if (records != null ) {
239239 for (Map .Entry <String ,Map <String ,String >> record : records .entrySet ()) {
240240 for (String experimentKey : record .getValue ().keySet ()) {
241241 Experiment experiment = projectConfig .getExperimentKeyMapping ().get (experimentKey );
242242 if (experiment == null || !experiment .isRunning ()) {
243- userExperimentRecord .remove (record .getKey (), experimentKey );
243+ userProfile .remove (record .getKey (), experimentKey );
244244 }
245245 }
246246 }
0 commit comments