Пример #1
0
 /**
  * Create a ResourceConfig that is the combination of an existing ResourceConfig and this delta
  *
  * @param orig the original ResourceConfig
  * @return updated ResourceConfig
  */
 public ResourceConfig mergeInto(ResourceConfig orig) {
   ResourceConfig deltaConfig = _builder.build();
   ResourceConfigBuilder builder =
       ResourceConfigBuilder.newInstance()
           .with(orig.getId())
           .rebalancerConfig(orig.getRebalancerConfig())
           .schedulerTaskConfig(orig.getSchedulerTaskConfig())
           .userConfig(orig.getUserConfig())
           .bucketSize(orig.getBucketSize())
           .batchMessageMode(orig.getBatchMessageMode());
   for (Fields field : _updateFields) {
     switch (field) {
       case REBALANCER_CONFIG:
         builder.rebalancerConfig(deltaConfig.getRebalancerConfig());
         break;
       case USER_CONFIG:
         builder.userConfig(deltaConfig.getUserConfig());
         break;
       case BUCKET_SIZE:
         builder.bucketSize(deltaConfig.getBucketSize());
         break;
       case BATCH_MESSAGE_MODE:
         builder.batchMessageMode(deltaConfig.getBatchMessageMode());
         break;
     }
   }
   return builder.build();
 }
Пример #2
0
 /**
  * Set the batch message mode
  *
  * @param batchMessageMode true to enable, false to disable
  * @return Delta
  */
 public Delta setBatchMessageMode(boolean batchMessageMode) {
   _builder.batchMessageMode(batchMessageMode);
   _updateFields.add(Fields.BATCH_MESSAGE_MODE);
   return this;
 }
Пример #3
0
 /**
  * Set the bucket size
  *
  * @param bucketSize the size to use
  * @return Delta
  */
 public Delta setBucketSize(int bucketSize) {
   _builder.bucketSize(bucketSize);
   _updateFields.add(Fields.BUCKET_SIZE);
   return this;
 }
Пример #4
0
 /**
  * Set the user configuration
  *
  * @param userConfig user-specified properties
  * @return Delta
  */
 public Delta setUserConfig(UserConfig userConfig) {
   _builder.userConfig(userConfig);
   _updateFields.add(Fields.USER_CONFIG);
   return this;
 }
Пример #5
0
 /**
  * Set the rebalancer configuration
  *
  * @param config properties of interest for rebalancing
  * @return Delta
  */
 public Delta setRebalancerConfig(RebalancerConfiguration config) {
   _builder.rebalancerConfig(config);
   _updateFields.add(Fields.REBALANCER_CONFIG);
   return this;
 }
Пример #6
0
 /**
  * Instantiate the delta for a resource config
  *
  * @param resourceId the resource to update
  */
 public Delta(ResourceId resourceId) {
   _builder = ResourceConfigBuilder.newInstance().with(resourceId);
   _updateFields = Sets.newHashSet();
 }