Search in sources :

Example 1 with WaitMode

use of com.ms.silverking.cloud.dht.WaitMode in project SilverKing by Morgan-Stanley.

the class ProtoRetrievalMessageGroup method getRetrievalOptions.

public static InternalRetrievalOptions getRetrievalOptions(MessageGroup mg) {
    int retrievalWaitByte;
    RetrievalType retrievalType;
    WaitMode waitMode;
    int miscOptionsByte;
    VersionConstraint vc;
    ByteBuffer optionBuffer;
    boolean verifyIntegrity;
    boolean updateSecondariesOnMiss;
    optionBuffer = mg.getBuffers()[optionBufferIndex];
    retrievalWaitByte = optionBuffer.get(RetrievalResponseMessageFormat.retrievalTypeWaitModeOffset);
    // begin retrievalType, waitMode decoding
    // see ProtoRetrievalMessageGroup() for encoding
    retrievalType = EnumValues.retrievalType[retrievalWaitByte >> 4];
    waitMode = EnumValues.waitMode[retrievalWaitByte & 0x0f];
    // end retrievalType, waitMode decoding
    miscOptionsByte = optionBuffer.get(RetrievalResponseMessageFormat.miscOptionsOffset);
    verifyIntegrity = (miscOptionsByte & 0x2) != 0;
    updateSecondariesOnMiss = (miscOptionsByte & 0x1) != 0;
    vc = new VersionConstraint(optionBuffer.getLong(RetrievalResponseMessageFormat.vcMinOffset), optionBuffer.getLong(RetrievalResponseMessageFormat.vcMaxOffset), EnumValues.versionConstraint_Mode[optionBuffer.get(RetrievalResponseMessageFormat.vcModeOffset)], optionBuffer.getLong(RetrievalResponseMessageFormat.vcMaxStorageTimeOffset));
    return new InternalRetrievalOptions(OptionsHelper.newRetrievalOptions(retrievalType, waitMode, vc, updateSecondariesOnMiss, getSecondaryTargets(mg)), verifyIntegrity);
}
Also used : VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint) RetrievalType(com.ms.silverking.cloud.dht.RetrievalType) ByteBuffer(java.nio.ByteBuffer) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions) VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint) WaitMode(com.ms.silverking.cloud.dht.WaitMode)

Aggregations

RetrievalType (com.ms.silverking.cloud.dht.RetrievalType)1 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 WaitMode (com.ms.silverking.cloud.dht.WaitMode)1 InternalRetrievalOptions (com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)1 ByteBuffer (java.nio.ByteBuffer)1