Commit 84ba33f3 authored by chiaming2000's avatar chiaming2000
Browse files

Added admin API to get max identity count in kinetic Limits message.

Simulator does not enforce the max identity count (yet).  It returns a
limit count of (-1).
parent d1b6eb31
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -458,6 +458,10 @@ public class DefaultKineticLog implements KineticLog {
            LimitsInfo.setMaxKeyRangeCount(limits.getMaxKeyRangeCount());
        }
        
        if (limits.hasMaxIdentityCount()) {
            LimitsInfo.setMaxIdentityCount(limits.getMaxIdentityCount());
        }

        return LimitsInfo;
    }
}
+23 −0
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@ public class Limits {
    // max key range count;
    private int maxKeyRangeCount = 0;
    
    //max identity count
    private int maxIdentityCount = -1;

    /**
     * Get the value of max key size.
     * 
@@ -229,4 +232,24 @@ public class Limits {
    public void setMaxKeyRangeCount(int maxKeyRangeCount) {
        this.maxKeyRangeCount = maxKeyRangeCount;
    }
    
    /**
     * Get max identity count. -1 means not enforced.
     * 
     * @return max identity count.
     */
    public int getMaxIdentityCount() {
        return this.maxIdentityCount;
    }
    
    /**
     * Set max identity count.
     * 
     * @param maxIdentityCount the max identity count to be set.
     */
    public void setMaxIdentityCount (int maxIdentityCount) {
        this.maxIdentityCount = maxIdentityCount;
    }
    
    
}
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ public abstract class LimitsUtil {
        limits.setMaxMessageSize(config.getMaxMessageSize());
        limits.setMaxKeyRangeCount(config.getMaxSupportedKeyRangeSize());
        
        limits.setMaxIdentityCount(config.getMaxIdentityCount());

        return limits.build();
    }
}
+20 −2
Original line number Diff line number Diff line
@@ -188,15 +188,22 @@ public class SimulatorConfiguration extends Properties {
     */
    private static int maxMessageSize = -1;
    
    /**
     * max supported identity cout.
     * 
     * -1 means not enforced.
     */
    private static int maxIdentityCount = -1;
    
    /**
     * current simulator version.
     */
    public static final String SIMULATOR_VERSION = "0.6.0.3-SNAPSHOT";
    public static final String SIMULATOR_VERSION = "0.7.0.2-SNAPSHOT";
    
    /**
     * simulator source commit hash.
     */
    public static final String SIMULATOR_SOURCE_HASH = "b1badd928fc2ee618ecbde8be0fbadd0aac447fe";
    public static final String SIMULATOR_SOURCE_HASH = "d1b6eb31cf7ce2a34d5e5f65fadc82151990b8dd";
    
    /**
     * current supported protocol version defined at kinetic-protocol repository.
@@ -748,6 +755,17 @@ public class SimulatorConfiguration extends Properties {
        return maxSupportedTagSize;
    }
    
    /**
     * Get maximum identity count.
     * 
     * Returns -1 means not enforced by the current implementation.
     * 
     * @return default value (-1)
     */
    public static int getMaxIdentityCount() {
        return maxIdentityCount;
    }

    /**
     * Get the current simulator version.
     *
+3 −0
Original line number Diff line number Diff line
@@ -347,6 +347,8 @@ public class KineticAdminTest extends IntegrationTestCase {
        // assertTrue(log.getLimits().getMaxMessageSize() >= 0);
        // assertTrue(log.getLimits().getMaxKeyRangeCount() >= 0);
        
        logger.info("get max identity count: " + log.getLimits().getMaxIdentityCount());

        logger.info(this.testEndInfo());
    }
    
@@ -1593,6 +1595,7 @@ public class KineticAdminTest extends IntegrationTestCase {
        // assertTrue(log.getLimits().getMaxConnections() >= 0);
        // assertTrue(log.getLimits().getMaxMessageSize() >= 0);
        // assertTrue(log.getLimits().getMaxKeyRangeCount() >= 0);
        logger.info("max identity count: " + respond1.getCommand().getBody().getGetLog().getLimits().getMaxIdentityCount() );
    }

    @Test