Package org.neo4j.kernel.impl.nioneo.store

Examples of org.neo4j.kernel.impl.nioneo.store.PropertyBlock


    private boolean removePrimitiveProperty( PrimitiveRecord primitive,
                                             String property )
    {
        PropertyRecord current = null;
        PropertyBlock target = null;
        long nextProp = primitive.getNextProp();
        int propIndex = indexHolder.getKeyId( property );
        if ( nextProp == Record.NO_NEXT_PROPERTY.intValue() || propIndex == -1 )
        {
            // No properties or no one has that property, nothing changed
            return false;
        }
        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            current = getPropertyStore().getRecord( nextProp );
            if ( (target = current.removePropertyBlock( propIndex )) != null )
            {
                if ( target.isLight() )
                {
                    getPropertyStore().makeHeavy( target );
                }
                for ( DynamicRecord dynRec : target.getValueRecords() )
                {
                    current.addDeletedRecord( dynRec );
                }
                break;
            }
View Full Code Here


        if ( index == -1 )
        {
            index = createNewPropertyIndex( name );
        }
        PropertyBlock block = new PropertyBlock();
        getPropertyStore().encodeValue( block, index, value );
        int size = block.getSize();

        /*
         * current is the current record traversed
         * thatFits is the earliest record that can host the block
         * thatHas is the record that already has a block for this index
         */
        PropertyRecord current = null, thatFits = null, thatHas = null;
        /*
         * We keep going while there are records or until we both found the
         * property if it exists and the place to put it, if exists.
         */
        while ( !(nextProp == Record.NO_NEXT_PROPERTY.intValue() || (thatHas != null && thatFits != null)) )
        {
            current = getPropertyStore().getRecord( nextProp );
            /*
             * current.getPropertyBlock() is cheap but not free. If we already
             * have found thatHas, then we can skip this lookup.
             */
            if ( thatHas == null && current.getPropertyBlock( index ) != null )
            {
                thatHas = current;
                PropertyBlock removed = thatHas.removePropertyBlock( index );
                if ( removed.isLight() )
                {
                    getPropertyStore().makeHeavy( removed );
                    for ( DynamicRecord dynRec : removed.getValueRecords() )
                    {
                        thatHas.addDeletedRecord( dynRec );
                    }
                }
                getPropertyStore().updateRecord( thatHas );
View Full Code Here

            if ( keyId == -1 )
            {
                keyId = createNewPropertyIndex( entry.getKey() );
            }

            PropertyBlock block = new PropertyBlock();
            propStore.encodeValue( block, keyId, entry.getValue() );
            if ( currentRecord.size() + block.getSize() > PropertyType.getPayloadSize() )
            {
                // Here it means the current block is done for
                PropertyRecord prevRecord = currentRecord;
                // Create new record
                long propertyId = propStore.nextId();
View Full Code Here

        propertyId++;
        int index=0;
        holder.propertyRecords[index++] = currentRecord;
        for (int i = 0; i < holder.propertyCount; i++) {
            Property property = holder.properties[i];
            PropertyBlock block = property.block;
            if (currentRecord.size() + block.getSize() > PAYLOAD_SIZE){
                currentRecord.setNextProp(propertyId);
                currentRecord = createRecord(propertyId);
                currentRecord.setPrevProp(propertyId-1);
                propertyId++;
                holder.propertyRecords[index++] = currentRecord;
View Full Code Here

        propertyId++;
        int index=0;
        holder.propertyRecords[index++] = currentRecord;
        for (int i = 0; i < holder.propertyCount; i++) {
            Property property = holder.properties[i];
            PropertyBlock block = property.block;
            if (currentRecord.size() + block.getSize() > PAYLOAD_SIZE){
                currentRecord.setNextProp(propertyId);
                currentRecord = createRecord(propertyId);
                currentRecord.setPrevProp(propertyId-1);
                propertyId++;
                holder.propertyRecords[index++] = currentRecord;
View Full Code Here

    private boolean removePrimitiveProperty( PrimitiveRecord primitive,
            String property )
    {
        PropertyRecord current = null;
        PropertyBlock target = null;
        long nextProp = primitive.getNextProp();
        int propIndex = indexHolder.getKeyId(property);
        if ( nextProp == Record.NO_NEXT_PROPERTY.intValue() || propIndex == -1 )
        {
            // No properties or no one has that property, nothing changed
            return false;
        }
        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            current = getPropertyStore().getRecord( nextProp );
            if ( ( target = current.removePropertyBlock( propIndex ) ) != null )
            {
                if ( target.isLight() )
                {
                    getPropertyStore().makeHeavy( target );
                }
                for ( DynamicRecord dynRec : target.getValueRecords() )
                {
                    current.addDeletedRecord( dynRec );
                }
                break;
            }
View Full Code Here

        if ( index == -1 )
        {
            index = createNewPropertyIndex( name );
        }
        PropertyBlock block = new PropertyBlock();
        getPropertyStore().encodeValue( block, index, value );
        int size = block.getSize();

        /*
         * current is the current record traversed
         * thatFits is the earliest record that can host the block
         * thatHas is the record that already has a block for this index
         */
        PropertyRecord current = null, thatFits = null, thatHas = null;
        /*
         * We keep going while there are records or until we both found the
         * property if it exists and the place to put it, if exists.
         */
        while ( !( nextProp == Record.NO_NEXT_PROPERTY.intValue() || ( thatHas != null && thatFits != null ) ) )
        {
            current = getPropertyStore().getRecord( nextProp );
            /*
             * current.getPropertyBlock() is cheap but not free. If we already
             * have found thatHas, then we can skip this lookup.
             */
            if ( thatHas == null && current.getPropertyBlock( index ) != null )
            {
                thatHas = current;
                PropertyBlock removed = thatHas.removePropertyBlock( index );
                if ( removed.isLight() )
                {
                    getPropertyStore().makeHeavy( removed );
                    for ( DynamicRecord dynRec : removed.getValueRecords() )
                    {
                        thatHas.addDeletedRecord( dynRec );
                    }
                }
                getPropertyStore().updateRecord( thatHas );
View Full Code Here

            if ( keyId == -1 )
            {
                keyId = createNewPropertyIndex( entry.getKey() );
            }

            PropertyBlock block = new PropertyBlock();
            propStore.encodeValue( block, keyId, entry.getValue() );
            if ( currentRecord.size() + block.getSize() > PropertyType.getPayloadSize() )
            {
                // Here it means the current block is done for
                PropertyRecord prevRecord = currentRecord;
                // Create new record
                long propertyId = propStore.nextId();
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.impl.nioneo.store.PropertyBlock

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.