Search in sources :

Example 16 with VersionConstraint

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

the class AbstractSegment method getResolvedOffset.

int getResolvedOffset(DHTKey key, VersionConstraint vc) {
    int offset;
    offset = getRawOffset(key);
    if (debugRetrieve || Log.levelMet(Level.FINE)) {
        Log.warning("segment number: " + getSegmentNumber());
        Log.warning("key offset: ", key + " " + offset);
    }
    if (offset == noSuchKey) {
        if (debugRetrieve) {
            Log.warning("noSuchKey");
        }
        return noSuchKey;
    } else {
        if (offset < 0) {
            OffsetList offsetList;
            // System.out.printf("offset %d -offset %d\n", offset, -offset);
            if (debugRetrieve) {
                Log.warning("Looking in offset list: " + -offset);
            }
            offsetList = offsetListStore.getOffsetList(-offset);
            if (debugRetrieve) {
                Log.warning("offsetList: ", offsetList);
                offsetList.displayForDebug();
            }
            offset = offsetList.getOffset(vc, null);
            if (offset < 0) {
                // FUTURE - think about this
                offset = noSuchKey;
                if (debugRetrieve) {
                    Log.warning("Couldn't find key in offset list. options: " + vc);
                }
            }
            if (debugRetrieve || Log.levelMet(Level.FINE)) {
                Log.warning("offset list offset: ", key + " " + offset);
            }
        }
        if (offset < 0) {
            Log.fine("getResolvedOffset < 0");
            return noSuchKey;
        } else {
            return offset;
        }
    }
}
Also used : VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint)

Aggregations

VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)16 ByteBuffer (java.nio.ByteBuffer)6 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)4 RetrievalOptions (com.ms.silverking.cloud.dht.RetrievalOptions)3 InternalRetrievalOptions (com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)3 PutException (com.ms.silverking.cloud.dht.client.PutException)2 KeyAndVersionChecksum (com.ms.silverking.cloud.dht.daemon.storage.KeyAndVersionChecksum)2 UUIDBase (com.ms.silverking.id.UUIDBase)2 LongInterval (com.ms.silverking.numeric.LongInterval)2 IOException (java.io.IOException)2 RetrievalType (com.ms.silverking.cloud.dht.RetrievalType)1 WaitMode (com.ms.silverking.cloud.dht.WaitMode)1 RetrievalException (com.ms.silverking.cloud.dht.client.RetrievalException)1 KeyAndInteger (com.ms.silverking.cloud.dht.common.KeyAndInteger)1 SSStorageParameters (com.ms.silverking.cloud.dht.serverside.SSStorageParameters)1 Date (java.util.Date)1 Map (java.util.Map)1 NavigableMap (java.util.NavigableMap)1 TreeMap (java.util.TreeMap)1