Package dovetaildb.bytes

Examples of dovetaildb.bytes.ArrayBytes


  static boolean verifySegmentPush(SegmentPush push) {
    push = push.copy();
    TraversalStack stack = new TraversalStack(push.copy());
    long lastDocId = Long.MIN_VALUE;
    Bytes lastTerm = new ArrayBytes(new byte[]{});
    while(stack.nextOrDown()) {
      stack.printPosition();
      long docId = stack.getCurrent().getDocId();
      if (docId < lastDocId) {
        throw new RuntimeException("DOC ID ERROR: cur="+docId+" prev="+lastDocId);
View Full Code Here


      data = index.getRange(Range.OPEN_RANGE, revNum);
      int capacity = value.getDeletions().size()+value.getEntries().size();
      if (capacity > 0) {
        ArrayList<Bytes> idTerms = new ArrayList<Bytes>(capacity);
        for(String key : value.getDeletions()) {
          idTerms.add(new CompoundBytes(ID_BYTES, new ArrayBytes(Util.decodeString(key))));
        }
        for(String key : entries.keySet()) {
          idTerms.add(new CompoundBytes(ID_BYTES, new ArrayBytes(Util.decodeString(key))));
        }
        idQuery = index.getTerms(idTerms, revNum);
      }
    }
    long lastDocId = Long.MIN_VALUE;
View Full Code Here

  public static final char TYPE_CHAR_MAP    = '{';
  public static final char CHAR_ENTRY_SEP   = ':';
 
  public static Bytes sencodeMapKey(String key) {
    try {
      return new ArrayBytes(((String)key).getBytes("utf-8"));
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

        // lexiographic sort puts big negatives below small negatives
        bits ^= 0xFFFFFFFFFFFFFFFFL;
      } else {
        bits ^= 0x8000000000000000L;
      }
      return new ArrayBytes(new byte[] {
          'n',
          (byte)((bits >>> 8 * 7) & 0xFF),
          (byte)((bits >>> 8 * 6) & 0xFF),
          (byte)((bits >>> 8 * 5) & 0xFF),
          (byte)((bits >>> 8 * 4) & 0xFF),
          (byte)((bits >>> 8 * 3) & 0xFF),
          (byte)((bits >>> 8 * 2) & 0xFF),
          (byte)((bits >>> 8 * 1) & 0xFF),
          (byte)((bits) & 0xFF)});
    } else if (val instanceof String) {
      try {
        Bytes valBytes = new ArrayBytes(((String)val).getBytes("utf-8"));
        return new CompoundBytes(HEADER_BYTE_S, valBytes);
      } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
      }
    } else if (val == null) {
View Full Code Here

  }

  public static Bytes sencodeListIndex(int index) {
    byte hiIdxByte = (byte)(index >> 8);
    byte loIdxByte = (byte)(index & 0xff);
    ArrayBytes idxBytes = new ArrayBytes(new byte[]{hiIdxByte,loIdxByte});
    return idxBytes;
  }
View Full Code Here

        oBytes.data = data;
        oBytes.len = len;
        oBytes.pos = pos;
        return other;
      } else {
        return new ArrayBytes(this.getBytes());
      }
    }
View Full Code Here

            thisByte++;
          }
          cmpBytes[j-curLen] = (byte)thisByte;
        }
        // needs a compare key
        mapping[i] = new CompoundBytes(cur, new ArrayBytes(cmpBytes));
      }
      prev = cur;
    }
    assert (mapping.length & (mapping.length-1)) == 0; // assert length is a power of 2
    this.numCompressedBits = integerLogBase2RoundDown(mapping.length);
View Full Code Here

        term = subQueryNode.findAnyMatching(docId, prefix);
      } else {
        Bytes min = compress(prefix);
        byte[] prefixBytes = prefix.getBytes();
        Util.incrementBinary(prefixBytes);
        Bytes max = compress(new ArrayBytes(prefixBytes));
        Range r = new Range(ArrayBytes.EMPTY_BYTES, ArrayBytes.EMPTY_BYTES, ArrayBytes.EMPTY_BYTES, true, true);
        r.setBoundsAndExtractPrefix(min, max);
        term = subQueryNode.findAnyMatching(docId, r.getPrefix());
      }
      if (term == null) return null;
View Full Code Here

 
  public byte[] getTermBytes() {
    return term.getBytes();
  }
  public void setTermBytes(byte[] term) {
    this.term = new ArrayBytes(term);
  }
View Full Code Here

  protected Bytes termForTxnBag(String bag, long txn) {
    byte[] bagNameBytes = bag.getBytes();
    byte[] revNumBytes = new byte[9];
    Util.beLongToBytes(txn, revNumBytes, 1);
    return new CompoundBytes(
        new ArrayBytes(bagNameBytes),
        new ArrayBytes(revNumBytes));
  }
View Full Code Here

TOP

Related Classes of dovetaildb.bytes.ArrayBytes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.