Package com.alvazan.orm.api.z8spi.action

Examples of com.alvazan.orm.api.z8spi.action.IndexColumn


    String indexCfName = action.getIndexCfName();
    if (indexCfName.equalsIgnoreCase("BytesIndice"))
      return;
    byte[] family = Bytes.toBytes(indexCfName);
    byte[] rowKey = action.getRowKey();
    IndexColumn column = action.getColumn();
    byte[] value = column.getPrimaryKey();
    Delete delete = new Delete(rowKey);
    delete.deleteColumn(family, value);
    try {
      hTable.delete(delete);
      hTable.flushCommits();
View Full Code Here


  private void persistIndex(PersistIndex action, MetaLookup ormSession) {
    String indexCfName = action.getIndexCfName();
    Info info = lookupOrCreate(indexCfName, ormSession);
    HColumnDescriptor hColFamily = info.getColFamily();
    byte[] rowKey = action.getRowKey();
    IndexColumn column = action.getColumn();
    byte[] key = column.getIndexedValue();
    byte[] value = column.getPrimaryKey();
    Get get = new Get(rowKey);
    Object keyToPersist = null;
    byte[] byteArr = null;
    if (key != null) {
      if ((indexCfName.equalsIgnoreCase("IntegerIndice"))) {
View Full Code Here

  }
  public byte[] getPrimaryKeyRaw(ViewInfo info) {
    Wrapper wrapper = colNameToValue.get(info);
    if(wrapper == null)
      return null;
    IndexColumn col = colNameToValue.get(info).getCol();
    return col.getPrimaryKey();
  }
View Full Code Here

    @Override
    public com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> nextImpl() {
        loadCache(false);
        if (cachedRows == null || !cachedRows.hasNext())
            return null;
        IndexColumn indexCol = convertToIndexColFromId(cachedRows.next());
        return new Holder<IndexColumn>(indexCol);
    }
View Full Code Here

    @Override
    public com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> previousImpl() {
        loadCache(true);
        if (cachedRows == null || !cachedRows.hasPrevious())
            return null;
        IndexColumn indexCol = convertToIndexColFromId(cachedRows.previous());
        return new Holder<IndexColumn>(indexCol);
    }
View Full Code Here

        }
    }

    private IndexColumn convertToIndexColFromId(DBObject col) {
        Object pk = col.get("_id");
        IndexColumn c = new IndexColumn();
        // c.setColumnName(columnName); Will we ever need this now?
        if (pk != null) {
            c.setPrimaryKey((byte[]) pk);
            c.setIndexedValue((byte[]) pk);
        }
        c.setValue(null);
        return c;
    }
View Full Code Here

    } else {
      for (Result result : results) {
        List<org.apache.hadoop.hbase.KeyValue> hKeyValue = result.list();
        if (hKeyValue != null && !hKeyValue.isEmpty()) {
          for (org.apache.hadoop.hbase.KeyValue keyValue : hKeyValue) {
            IndexColumn indCol = CursorOfHbaseIndexes
                .convertToIndexCol(keyValue);
            finalRes.add(indCol);
          }
        }
      }
View Full Code Here

   
  }

  private Holder<IndexColumnInfo> createResult(
      com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> next) {
    IndexColumn indCol = next.getValue();
    IndexColumnInfo info = new IndexColumnInfo();   
   
    if(cachedFromRightResults.hasNext()) {
      //We need to compare lastCachedRightSide with our incoming to make see if they pair up
      //or else move to the next right side answer.
      ByteArray pkOfRightView = lastCachedRightSide.getPrimaryKey(rightView);
      ByteArray valueOfLeft = new ByteArray(indCol.getIndexedValue());
      if(!valueOfLeft.equals(pkOfRightView)) {
        lastCachedRightSide = cachedFromRightResults.next();
      }   
 
      info.mergeResults(lastCachedRightSide);
View Full Code Here

    if(batchListener != null)
      batchListener.beforeFetchingNextBatch();
    loadBatchIfNeeded();
    if(cachedLastCols != null && cachedLastCols.hasNext()) {
      Column<byte[]> col = cachedLastCols.next();
      IndexColumn indexedCol = CursorColumnSlice.convertToIndexCol(col);
      return new Holder<IndexColumn>(indexedCol);
    }
   
    while(true) {
      if(!theOneBatch.hasNext())
        return null;     
      Future<OperationResult<ColumnList<byte[]>>> future = theOneBatch.next();

      OperationResult<ColumnList<byte[]>> results = get(future);
      ColumnList<byte[]> columnList = results.getResult();
      cachedLastCols = columnList.iterator();

      if(cachedLastCols.hasNext()) {
        Column<byte[]> col = cachedLastCols.next();
        IndexColumn indexCol = CursorColumnSlice.convertToIndexCol(col);
 
        if(batchListener != null)
          batchListener.afterFetchingNextBatch(columnList.size());
        return new Holder<IndexColumn>(indexCol);
      }
View Full Code Here

  private Holder<T> nextColumn(Iterator<com.netflix.astyanax.model.Column<byte[]>> latestIterator) {
    com.netflix.astyanax.model.Column<byte[]> col = latestIterator.next();
    count++;
   
    if(isComposite) {
      IndexColumn c = convertToIndexCol(col);
      return new Holder<T>((T) c);
    } else {
      Object obj = col.getName();
      Column c = new Column();
      byte[] name = (byte[])obj;
      c.setName(name);
      c.setValue(col.getByteArrayValue());
      c.setTimestamp(col.getTimestamp());
      return new Holder<T>((T) c);
    }
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.action.IndexColumn

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.