public Region getKeyRegion(byte[] key) { if (!sorted) { regions.Sort(); sorted = true; } return(KeyValueUtil.Search(regions, key)); }
public int GetCounter(byte[] key) { byte[] value = Get(key); if (value == null || value.Length != 4) { throw new KVException("The key:" + key.ToString() + " is not a valid counter"); } return(KeyValueUtil.bytesToInt(value)); }
public int CompareTo(byte[] key) { int e1 = KeyValueUtil.Compare(key, start); int e2 = KeyValueUtil.Compare(key, end); if (e1 >= 0 && e2 <= 0) { return(0); } else if (e1 < 0) { return(1); } else { return(-1); } }
public int CompareTo(Region region) { if (this == region) { return(0); } int e1 = KeyValueUtil.Compare(start, region.End); int e2 = KeyValueUtil.Compare(end, region.Start); if (e1 > 0) { return(1); } else if (e2 < 0) { return(-1); } else { return(0); } }