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

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


    private void persistIndex(PersistIndex action, MetaLookup ormSession) {
        String indexCfName = action.getIndexCfName();
        String table = lookupOrCreate(indexCfName, ormSession);
        byte[] rowKey = action.getRowKey();
        IndexColumn column = action.getColumn();
        byte[] key = column.getIndexedValue();
        byte[] value = column.getPrimaryKey();

        try {

            Object keyObject = null;
            if (key != null) {
View Full Code Here


        String colFamily = action.getIndexCfName();
        if (colFamily.equalsIgnoreCase("BytesIndice"))
            return;
        String table = lookupOrCreate(colFamily, ormSession);
        String rowKey = StandardConverters.convertFromBytes(String.class, action.getRowKey());
        IndexColumn column = action.getColumn();
        byte[] value = column.getPrimaryKey();
        boolean exists = findIndexRow(table, rowKey, value);
        if (!exists) {
            if (log.isInfoEnabled())
                log.info("Index: " + column.toString() + " already removed.");
        } else {
            Clause eqClause = QueryBuilder.eq("id", rowKey);
            Clause fkClause = QueryBuilder.eq("colvalue", ByteBuffer.wrap(value));
            Query query = QueryBuilder.delete().from(keys, table).where(eqClause).and(fkClause);
            session.execute(query);
View Full Code Here

            indValue = row.getFloat("colname");
        }
        ByteBuffer data = row.getBytes("colvalue");
        byte[] val = new byte[data.remaining()];
        data.get(val);
    IndexColumn c = new IndexColumn();
    // c.setColumnName(columnName); Will we ever need this now?
    if (val != null) {
      c.setPrimaryKey(val);
    }
    if (indValue != null) {
      c.setIndexedValue(StandardConverters.convertToBytes(indValue));
    }

    c.setValue(null);
    return c;
  }
View Full Code Here

        value = one.convertFromStorage2(column.getCompositeSubName());
      }
      if(!valuesEqual(pt.getIndexedValue(), value)) {
        System.out.println("Entity with rowkey="+pt.getKeyAsString()+" has extra incorrect index point with value="+pt.getIndexedValueAsString()+" correct value should be= "+value);
        s.removeIndexPoint(pt, data.getPartitionBy(), data.getPartitionId());
        IndexColumn col = new IndexColumn();
        col.setColumnName(colName);
        col.setPrimaryKey(pt.getRawKey());
        col.setTtl(typedRow.getRowTtl());
        byte[] indValue = StandardConverters.convertToBytes(value);
        col.setIndexedValue(indValue);
        IndexPoint newPoint = new IndexPoint(pt.getRowKeyMeta(), col,data.getColumnMeta());
        s.addIndexPoint(newPoint, data.getPartitionBy(), data.getPartitionId());
        return true;
      }
    }
View Full Code Here

    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
    byte[] rowKey = info.getRowKey();
    String indColFamily = info.getIndexColFamily();
    DboTableMeta cf = info.getEntityColFamily();
   
    IndexColumn col = new IndexColumn();
    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    session.removeFromIndex(cf, indColFamily, rowKey, col);
  }
View Full Code Here

    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
    byte[] rowKey = info.getRowKey();
    String indColFamily = info.getIndexColFamily();
    DboTableMeta cf = info.getEntityColFamily();
   
    IndexColumn col = new IndexColumn();
    if(colMeta != null)
      col.setColumnName(colMeta.getColumnName());
    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    col.setTtl(pt.getTtl());
    session.persistIndex(cf, indColFamily, rowKey, col);
  }
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, null);
      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 = new OurColumnListIterator(columnList);

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

    if(batchListener != null)
      batchListener.beforeFetchingNextBatch();
    loadBatchIfNeeded();
    if(cachedLastCols != null && cachedLastCols.hasPrevious()) {
      Column<byte[]> col = cachedLastCols.previous();
      IndexColumn indexedCol = CursorColumnSlice.convertToIndexCol(col, null);
      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 = new OurColumnListIterator(columnList);
      while(cachedLastCols.hasNext())cachedLastCols.next();


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

      return null;
   
    Row<byte[], byte[]> row = iterator.next();
    byte[] key = row.getKey();
   
    IndexColumn col = new IndexColumn();
    col.setPrimaryKey(key);
    return new Holder<IndexColumn>(col);
  }
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

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.