All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.cache.FixedPartitionAttributes Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed 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. See accompanying
 * LICENSE file.
 */
package com.gemstone.gemfire.cache;

import com.gemstone.gemfire.internal.cache.FixedPartitionAttributesImpl;

/**
 * Composite date type used to distribute the attributes for a fixed partition.
 * 

* * {@link com.gemstone.gemfire.cache.PartitionAttributes#getFixedPartitionAttributes()} * returns all fixed partitions in Partitioned Region attributes.

* {@link com.gemstone.gemfire.cache.PartitionAttributesFactory#addFixedPartitionAttributes(FixedPartitionAttributes)} * configures FixedPartitionAttributes in * PartitionedRegionAttributes

* * @see com.gemstone.gemfire.cache.PartitionAttributes * @see com.gemstone.gemfire.cache.PartitionAttributesFactory * * @author kbachhav * @since 6.6 */ public abstract class FixedPartitionAttributes { private final static boolean DEFAULT_PRIMARY_STATUS = false; private final static int DEFAULT_NUM_BUCKETS = 1; /** * Creates an instance of FixedPartitionAttributes. * * @param name * Name of the fixed partition. */ final public static FixedPartitionAttributes createFixedPartition(String name) { return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary( DEFAULT_PRIMARY_STATUS).setNumBuckets(DEFAULT_NUM_BUCKETS); } /** * Creates an instance of FixedPartitionAttributes. * * @param name * Name of the fixed partition. * @param isPrimary * True if this member is the primary for the partition. */ final public static FixedPartitionAttributes createFixedPartition( String name, boolean isPrimary) { return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary( isPrimary).setNumBuckets(DEFAULT_NUM_BUCKETS); } /** * Creates an instance of FixedPartitionAttributes. * * @param name * Name of the fixed partition. * @param isPrimary * True if this member is the primary for the partition. * @param numBuckets * Number of buckets allowed for the partition. */ final public static FixedPartitionAttributes createFixedPartition( String name, boolean isPrimary, int numBuckets) { return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary( isPrimary).setNumBuckets(numBuckets); } /** * Creates an instance of FixedPartitionAttributes. * * @param name * Name of the fixed partition. * @param numBuckets * Number of buckets allowed for the partition. */ final public static FixedPartitionAttributes createFixedPartition( String name, int numBuckets) { return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary( DEFAULT_PRIMARY_STATUS).setNumBuckets(numBuckets); } /** * Returns the name of the fixed partition. */ public abstract String getPartitionName(); /** * Returns whether this member is the primary for the partition. * * @return True if this member is the primary, false otherwise. */ public abstract boolean isPrimary(); /** * Returns the number of buckets allowed for the partition. */ public abstract int getNumBuckets(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy