Package org.apache.hbase.index.util

Examples of org.apache.hbase.index.util.ImmutableBytesPtr


    // simple map to make lookups easy while we build the map of tables to create
    Map<ImmutableBytesPtr, HTableInterfaceReference> tables =
        new HashMap<ImmutableBytesPtr, HTableInterfaceReference>(updates.size());
    for (Pair<Mutation, byte[]> entry : indexUpdates) {
      byte[] tableName = entry.getSecond();
      ImmutableBytesPtr ptr = new ImmutableBytesPtr(tableName);
      HTableInterfaceReference table = tables.get(ptr);
      if (table == null) {
        table = new HTableInterfaceReference(ptr);
        tables.put(ptr, table);
      }
View Full Code Here


  class DeleteFamilyHinter implements Hinter {

    @Override
    public KeyValue getHint(KeyValue peeked) {
      // check to see if we have another column to seek
      ImmutableBytesPtr nextFamily =
          getNextFamily(new ImmutableBytesPtr(peeked.getBuffer(), peeked.getFamilyOffset(),
              peeked.getFamilyLength()));
      if (nextFamily == null) {
        // no known next family, so we can be completely done
        done = true;
        return KeyValue.LOWESTKEY;
      }
        // there is a valid family, so we should seek to that
      return KeyValue.createFirstOnRow(peeked.getRow(), nextFamily.copyBytesIfNecessary(),
        HConstants.EMPTY_BYTE_ARRAY);
    }
View Full Code Here

   * @param tableName
   * @param m
   */
  public void addIndexUpdate(byte[] tableName, Mutation m) {
    // we only keep the most recent update
    ImmutableBytesPtr key = new ImmutableBytesPtr(tableName);
    Collection<Mutation> updates = map.get(key);
    if (updates == null) {
      updates = new SortedCollection<Mutation>(COMPARATOR);
      map.put(key, updates);
    }
View Full Code Here

        values = Collections.synchronizedMap(new HashMap<ColumnReference, ImmutableBytesPtr>());
      }
    }

    // check the value in the map
    ImmutableBytesPtr value = values.get(ref);
    if (value == null) {
      value = get(ref);
      values.put(ref, value);
    }
View Full Code Here

      return null;
    }
    // there is a next value - we only care about the current value, so we can just snag that
    KeyValue next = scan.next();
    if (ref.matches(next)) {
      return new ImmutableBytesPtr(next.getBuffer(), next.getValueOffset(), next.getValueLength());
    }
    return null;
  }
View Full Code Here

    private Iterator<Pair<byte[],List<Mutation>>> addRowMutations(final TableRef tableRef, final Map<ImmutableBytesPtr, Map<PColumn, byte[]>> values, long timestamp, boolean includeMutableIndexes) {
        final List<Mutation> mutations = Lists.newArrayListWithExpectedSize(values.size());
        Iterator<Map.Entry<ImmutableBytesPtr,Map<PColumn,byte[]>>> iterator = values.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<ImmutableBytesPtr,Map<PColumn,byte[]>> rowEntry = iterator.next();
            ImmutableBytesPtr key = rowEntry.getKey();
            PRow row = tableRef.getTable().newRow(timestamp, key);
            if (rowEntry.getValue() == null) { // means delete
                row.delete();
            } else {
                for (Map.Entry<PColumn,byte[]> valueEntry : rowEntry.getValue().entrySet()) {
View Full Code Here

  }

  @Override
  @SuppressWarnings("unchecked")
  public HTableInterface getTable(ImmutableBytesPtr tablename) throws IOException {
    ImmutableBytesPtr tableBytes = new ImmutableBytesPtr(tablename);
    synchronized (openTables) {
      HTableInterface table = (HTableInterface) openTables.get(tableBytes);
      if (table == null) {
        table = delegate.getTable(tablename);
        openTables.put(tableBytes, table);
View Full Code Here

      if(!durable){
        durable = m.getDurability() != Durability.SKIP_WAL;
      }

      // add the mutation to the batch set
      ImmutableBytesPtr row = new ImmutableBytesPtr(m.getRow());
      MultiMutation stored = mutations.get(row);
      // we haven't seen this row before, so add it
      if (stored == null) {
        stored = new MultiMutation(row, m.getWriteToWAL());
        mutations.put(row, stored);
View Full Code Here

    private int hashCode;

    public IndexedKeyValue() {}

    public IndexedKeyValue(byte[] bs, Mutation mutation) {
        this.indexTableName = new ImmutableBytesPtr(bs);
        this.mutation = mutation;
        this.hashCode = calcHashCode(indexTableName, mutation);
    }
View Full Code Here

     * complement to {@link #writeData(DataOutput)}.
     */
    @SuppressWarnings("javadoc")
    @Override
    public void readFields(DataInput in) throws IOException {
        this.indexTableName = new ImmutableBytesPtr(Bytes.readByteArray(in));
        Class<? extends Mutation> clazz;
        try {
            clazz = Class.forName(in.readUTF()).asSubclass(Mutation.class);
            this.mutation = clazz.newInstance();
            this.mutation.readFields(in);
View Full Code Here

TOP

Related Classes of org.apache.hbase.index.util.ImmutableBytesPtr

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.