Package com.alvazan.orm.api.z8spi.conv

Examples of com.alvazan.orm.api.z8spi.conv.ByteArray


  /* (non-Javadoc)
   * @see com.alvazan.orm.layer3.spi.db.inmemory.RowTemp#remove(byte[])
   */
  @Override
  public void remove(byte[] name) {
    ByteArray key = new ByteArray(name);
    columns.remove(key);
  }
View Full Code Here


    if (isExpired())
      return Collections.emptyList();

    NavigableMap<ByteArray, Column> map = columns;
    if(from != null) {
      ByteArray fromArray = new ByteArray(from);
      map = columns.tailMap(fromArray, true);
    }
   
    if(to != null) {
      ByteArray toArray = new ByteArray(to);
      map = map.headMap(toArray, true);
    }

    List<Column> list = deepCopy(map.values());
   
View Full Code Here

  }

  @Override
  public void addColumns(List<Column> cols) {
    for(Column c : cols) {
      ByteArray b = new ByteArray(c.getName());
      columns.put(b, c);
      updateExpire(c);
    }
  }
View Full Code Here

  }

  @Override
  public void removeColumns(Collection<byte[]> columnNames) {
    for(byte[] k : columnNames) {
      ByteArray b = new ByteArray(k);
      columns.remove(b);
    }
  }
View Full Code Here

  public Wrapper getIndexNode(ViewInfo view) {
    return colNameToValue.get(view);
  }

  public ByteArray getPrimaryKey(ViewInfo leftView) {
    return new ByteArray(getPrimaryKeyRaw(leftView));
  }
View Full Code Here

    List<KeyValue<Row>> finalRes = new ArrayList<KeyValue<Row>>();
    Iterator<byte[]> keyIter = keysToLookup.iterator();
    for (RowHolder<Row> r : results) {
      if (r == null) {
        byte[] key = keyIter.next();
        ByteArray b = new ByteArray(key);
        KeyValue<Row> kv = map.get(b);
        if (kv != null)
          finalRes.add(kv);
      } else {
        Row row = r.getValue();
View Full Code Here

    List<KeyValue<Row>> finalRes = new ArrayList<KeyValue<Row>>();
    Iterator<byte[]> keyIter = keysToLookup.iterator();
    for (RowHolder<Row> r : results) {
      if (r == null) {
        byte[] key = keyIter.next();
        ByteArray b = new ByteArray(key);
        KeyValue<Row> kv = map.get(b);
        if (kv != null)
          finalRes.add(kv);
      } else {
        Row row = r.getValue();
View Full Code Here

    if (resultArray == null) {
      for (byte[] key : keysToLookup) {
        KeyValue<Row> kv = new KeyValue<Row>();
        kv.setKey(key);
        kv.setValue(null);
        ByteArray b = new ByteArray(key);
        map.put(b, kv);
        cache.cacheRow(cf, key, kv.getValue());
      }
    } else {
      for (Result result : resultArray) {
        List<org.apache.hadoop.hbase.KeyValue> hKeyValue = result.list();
        KeyValue<Row> kv = new KeyValue<Row>();
        if (hKeyValue!= null && !hKeyValue.isEmpty()) {
          kv.setKey(result.getRow());
          Row r = rowProvider.get();
          processColumns(hKeyValue, r);
          kv.setValue(r);
        }
        ByteArray b = new ByteArray(result.getRow());
        map.put(b, kv);
        cache.cacheRow(cf, result.getRow(), kv.getValue());
      }
      for (byte[] key : keysToLookup) {
        ByteArray baKey = new ByteArray(key);
        if (!map.containsKey(baKey)) {
          KeyValue<Row> kv = new KeyValue<Row>();
          kv.setKey(key);
          kv.setValue(null);
          map.put(baKey, kv);
View Full Code Here

   
    Map<ByteArray, KeyValue<Row>> map = new HashMap<ByteArray, KeyValue<Row>>();
    while(resultingRows.hasNext()) {
      KeyValue<Row> kv = resultingRows.next();     
      byte[] key = (byte[]) kv.getKey();
      ByteArray b = new ByteArray(key);
      map.put(b, kv);
      cache.cacheRow(colFamily, key, kv.getValue());
    }
   
    //UNFORTUNATELY, astyanax's result is NOT ORDERED by the keys we provided so, we need to iterate over the whole thing here
    //into our own List :( :( .....okay, well, we are now in memory and would have been ordered but oh well....rework this later

    List<KeyValue<Row>> finalRes = new ArrayList<KeyValue<Row>>();
    Iterator<byte[]> keyIter = keysToLookup.iterator();
    for(RowHolder<Row> r : results) {
      if(r == null) {
        byte[] key = keyIter.next();
        ByteArray b = new ByteArray(key);
        KeyValue<Row> kv = map.get(b);
        finalRes.add(kv);       
      } else {
        Row row = r.getValue();
        KeyValue<Row> kv = new KeyValue<Row>();
View Full Code Here

        break;
      } else if(batchSize != null && batchSize.intValue() < counter)
        break;
     
      IndexColumnInfo rightResult = rightHolder.getValue();
      ByteArray pk = rightResult.getPrimaryKey(rightView);
      values.add(pk.getKey());
      rightListResults.add(rightResult);
      counter++;
    }
   
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.conv.ByteArray

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.