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

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


    }
   
    public void promote(Page page)
    {
        // Replace, reset Block in page.
        Block block = page.getBackingBlock() ;
        Block block2 = blockMgr.promote(block) ;
        if ( block2 != block )
        {       
            block2.setModified(true) ;
            // Change - reset Block in page.
            page.reset(block2) ;
        }
    }
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

        check(id) ;
        checkIfClosed() ;
        ByteBuffer bb = ByteBuffer.allocate(blockSize) ;
        readByteBuffer(id, bb) ;
        bb.rewind() ;
        Block block = new Block(id, bb) ;
        return block ;
    }
View Full Code Here

          throw new TDBTransactionException("Checksum error reading from the Journal.") ;

        JournalEntryType type = JournalEntryType.type(typeId) ;
        FileRef fileRef = FileRef.get(ref) ;

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

    }

    @Override
    public Block allocWrite(int maxBytes)
    {
        Block blk = other.allocWrite(maxBytes) ;
        info("allocWrite("+maxBytes+") -> "+blk.getId()) ;
        return blk ;
    }
View Full Code Here

    }
   
    public long write(String str)
    {
        str = compress(str) ;
        Block block = file.allocWrite(4*str.length()) ;
        int len = Bytes.toByteBuffer(str, block.getByteBuffer()) ;
        block.getByteBuffer().flip() ;
        file.completeWrite(block) ;
        return block.getId() ;
    }
View Full Code Here

        if ( writeBuffer == null || spaceRequired > writeBuffer.remaining() )
        {
            // Too big. Have flushed buffering if buffering.
            inAllocWrite = true ;
            ByteBuffer bb = ByteBuffer.allocate(bytesSpace) ;
            allocBlock = new Block(filesize, bb)
            allocLocation = -1 ;
            //log.info("AW:"+state()+"-> ----") ;
            return allocBlock ;
        }
       
        // Will fit.
        inAllocWrite = true ;
        int start = writeBuffer.position() ;
        // Old values for restoration
        oldBufferPosn = start ;
        oldBufferLimit = writeBuffer.limit() ;
       
        // id (but don't tell the caller yet).
        allocLocation = filesize+start ;
       
        // Slice it.
        writeBuffer.putInt(bytesSpace) ;
        writeBuffer.position(start + SizeOfInt) ;
        writeBuffer.limit(start+spaceRequired) ;
        ByteBuffer bb = writeBuffer.slice() ;

        allocBlock = new Block(allocLocation, bb) ;

        if ( logging )
            log("AW: %s->0x%X", state(), allocLocation) ;
        return allocBlock ;
    }
View Full Code Here

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

    {
        check(id) ;
        checkIfClosed() ;
        ByteBuffer bb = getByteBuffer(id) ;
        bb.position(0) ;
        Block block = new Block(id, bb) ;
        return 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.
        block = block.replicate( ) ;
        writeBlocks.put(block.getId(), block) ;
        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.