Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.apache.helix.model.builder;
 
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

Build a ConstraintItem corresponding to a state bound
Instantiate the builder
     = new ConstraintItemBuilder();
  }

  
Get the state model definition to constrain

Parameters:
stateModelDefId state model definition identifier
Returns:
StateConstraintItemBuilder
  public StateConstraintItemBuilder stateModel(StateModelDefId stateModelDefId) {
        stateModelDefId.stringify());
    return this;
  }

  
Get the state to constrain

Parameters:
state state object
Returns:
StateConstraintItemBuilder
  public StateConstraintItemBuilder state(State state) {
    return this;
  }

  
Set a numerical upper bound for the replicas that can be in a state

Parameters:
upperBound maximum replica count for a state, per partition
Returns:
StateConstraintItemBuilder
  public StateConstraintItemBuilder upperBound(int upperBound) {
        Integer.toString(upperBound));
    return this;
  }

  
Set an upper bound for the replicas that can be in a state. This can be numerical, or "N" for number of nodes, or "R" for total number of replicas per partition

Parameters:
dynamicUpperBound maximum replica count for a state, per partition, can also be "N" or "R"
Returns:
StateConstraintItemBuilder
  public StateConstraintItemBuilder dynamicUpperBound(String dynamicUpperBound) {
        dynamicUpperBound);
    return this;
  }

  
Get the ConstraintItem instance that is built

Returns:
ConstraintItem
  public ConstraintItem build() {
    return .build();
  }
New to GrepCode? Check out our FAQ X