Package com.hp.hpl.jena.tdb.base.block

Examples of com.hp.hpl.jena.tdb.base.block.Block


                // [TxTDB:PATCH-UP]
                // Direct: blkMgr.write(e.getBlock()) would work.
                // Mapped: need to copy over the bytes.
               
                BlockMgr blkMgr = mgrs.get(e.getFileRef()) ;
                Block blk = e.getBlock() ;
                log.debug("Replay: {} {}",e.getFileRef(), blk) ;
                blk.setModified(true) ;
                blkMgr.overwrite(blk) ;
               
//                Block blk = blkMgr.getWrite(e.getBlock().getId()) ;
//                blk.getByteBuffer().rewind() ;
//                blk.getByteBuffer().put(e.getBlock().getByteBuffer()) ;
View Full Code Here


            throw new TDBTransactionException("Failed to read block checksum (got "+lenRead+" bytes, not "+SizeofCRC+").") ;
        int checksum = Bytes.getInt(crcTrailer.array()) ;
        if ( checksum != (int)adler.getValue() )
          throw new TDBTransactionException("Checksum error reading from the Journal.") ;

        Block block = new Block(blockId, bb) ;
        return new JournalEntry(type, fileRef, block) ;
    }
View Full Code Here

    public Block allocate(int blockSize)
    {
        checkIfClosed() ;
        // Might as well allocate now.
        // This allocates the id.
        Block block = blockMgr.allocate(blockSize) ;
        // [TxTDB:TODO]
        // But we "copy" it by allocating ByteBuffer space.
        if ( active )
        {
            block = block.replicate( ) ;
            writeBlocks.put(block.getId(), block) ;
        }
        return block ;
    }
View Full Code Here

    @Override
    public Block getRead(long id)
    {
        checkIfClosed() ;
        Block block = localBlock(id) ;
        if ( block != null )
            return block ;
        block = blockMgr.getRead(id) ;
        if ( active )
            readBlocks.add(block.getId()) ;
        return block ;
    }
View Full Code Here

    @Override
    public Block getReadIterator(long id)
    {
        //logState() ;
        checkIfClosed() ;
        Block block = localBlock(id) ;
        if ( block == null )
            block = blockMgr.getReadIterator(id) ;
        if ( block == null )
            throw new BlockException("No such block: "+getLabel()+" "+id) ;
        if ( active )
            iteratorBlocks.add(block.getId()) ;
        return block ;
    }
View Full Code Here

    {
        // NB: If we are in a stack of BlockMgrs, after a transaction has committed,
        // we would be called via getRead and the upper Blockgr does the promotion.
        checkActive() ;
        checkIfClosed() ;
        Block block = localBlock(id) ;
        if ( block != null )
            return block ;
       
        // Get-as-read.
        block = blockMgr.getRead(id) ;
View Full Code Here

    @Override
    public Block allocWrite(int maxBytes)
    {
        if ( passthrough ) return base.allocWrite(maxBytes) ;
        Block block = transObjects.allocWrite(maxBytes) ;
        block = new Block(block.getId()+otherAllocOffset, block.getByteBuffer()) ;
        return block ;
    }
View Full Code Here

    @Override
    public void completeWrite(Block block)
    {
        if ( passthrough ) { base.completeWrite(block) ; return ; }
        block = new Block(block.getId()-otherAllocOffset, block.getByteBuffer()) ;
        transObjects.completeWrite(block) ;
    }
View Full Code Here

   
    @Override
    public void abortWrite(Block block)
    {
        if ( passthrough ) { base.abortWrite(block) ; return ; }
        block = new Block(block.getId()-otherAllocOffset, block.getByteBuffer()) ;
        transObjects.abortWrite(block) ;
    }
View Full Code Here

    {
        if ( blkSize > 0 && blkSize != this.blockSize )
            throw new FileException("Fixed blocksize only: request= "+blkSize+"fixed size="+this.blockSize) ;
        int x = allocateId() ;
        ByteBuffer bb = ByteBuffer.allocate(blkSize) ;
        Block block = new Block(x, bb) ;
        return block;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.base.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.