Package com.caucho.db.block

Examples of com.caucho.db.block.Block


    return Long.toHexString(blockId);
  }

  public void close()
  {
    Block rootBlock = _rootBlock;
    _rootBlock = null;
   
    if (rootBlock != null)
      rootBlock.free();
  }
View Full Code Here


  }

  public void init(Transaction xa)
    throws SQLException
  {
    Block block = _block;
    _block = null;
    _buffer = null;

    if (block != null) {
      block.free();
    }
   
    _blockId = 0;
    _rowOffset = Integer.MAX_VALUE / 2;
    _queryContext = null;
View Full Code Here

  public boolean nextBlock()
    throws IOException
  {
    byte []buffer = _buffer;

    Block block = _block;
    _block = null;
    _buffer = null;

    if (block != null) {
      block.free();
    }

    _blockId = _table.firstRowBlock(_blockId + Table.BLOCK_SIZE);

    if (_blockId < 0) {
      return false;
    }

    block = _xa.readBlock(_table, _blockId);

    buffer = block.getBuffer();
    _block = block;
    _buffer = buffer;
    _rowOffset = 0;

    return true;
View Full Code Here

    long blockId = _table.addressToBlockId(rowAddr);

    if (blockId != _blockId) {
      _blockId = blockId;
   
      Block block = _block;
      _block = null;
      _buffer = null;

      if (block != null) {
  block.free();
      }

      _block = _xa.readBlock(_table, _blockId);
      _buffer = _block.getBuffer();
    }
View Full Code Here

   * Sets the next row.
   */
  public void initNullRow()
    throws IOException
  {
    Block block = _block;
    _block = null;
    _buffer = null;

    if (block != null)
      block.free();

    _rowOffset = 0;
    _buffer = _nullBuffer;
  }
View Full Code Here

    _block.setDirty(_rowOffset, _rowOffset + _rowLength);
  }

  public void free()
  {
    Block block = _block;
    _block = null;

    if (block != null)
      block.free();
  }
View Full Code Here

      KeyCompare keyCompare = column.getIndexKeyCompare();

      if (keyCompare == null)
        continue;

      Block rootBlock = allocateIndexBlock();
      long rootBlockId = rootBlock.getBlockId();
      rootBlock.free();

      BTree btree = new BTree(this, rootBlockId, column.getLength(),
                              keyCompare);

      column.setIndex(btree);
View Full Code Here

      if (index == null)
        continue;

      long rootAddr = index.getIndexRoot();

      Block block = readBlock(addressToBlockId(rootAddr));

      try {
        byte []blockBuffer = block.getBuffer();

        synchronized (blockBuffer) {
          for (int j = 0; j < blockBuffer.length; j++) {
            blockBuffer[j] = 0;
          }

          block.setDirty(0, BLOCK_SIZE);
        }
      } finally {
        block.free();
      }
    }

    long blockAddr = 0;
View Full Code Here

    throws IOException, SQLException
  {
    if (log.isLoggable(Level.FINEST))
      log.finest("db table " + getName() + " insert row xa:" + xa);

    Block block = null;

    try {
      while (true) {
        long blockId = allocateInsertRowBlock();

        block = xa.loadBlock(this, blockId);

        int rowOffset = allocateRow(block, xa);

        if (rowOffset >= 0) {
          insertRow(queryContext, xa, columns, values,
                    block, rowOffset);

          block.saveAllocation();
         
          freeRowBlockId(blockId);

          return blockIdToAddress(blockId, rowOffset);
        }

        Block freeBlock = block;
        block = null;
        freeBlock.free();
      }
    } finally {
      if (block != null)
        block.free();
    }
View Full Code Here

    long rowTailOffset = _rowTailOffset.get();

    blockId = firstRowBlock(rowTailOffset);

    if (blockId <= 0) {
      Block block = allocateRow();

      blockId = block.getBlockId();
      // System.out.println("ALLOC: " + blockId + " " + _rowTailOffset.get() + " " + _rowTailTop);

      block.free();
    }

    _rowTailOffset.compareAndSet(rowTailOffset, blockId + BLOCK_SIZE);
   
    return blockId;
View Full Code Here

TOP

Related Classes of com.caucho.db.block.Block

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.