private void track( RecordStore<?> store, AbstractBaseRecord record ) { long id = max( record.getId(), record.requiresSecondaryUnit() ? record.getSecondaryUnitId() : -1 ); HighId highId = highIds.get( store ); if ( highId == null ) { highIds.put( store, new HighId( id ) ); } else { highId.track( id ); } }
private <T extends AbstractBaseRecord> void verifySecondaryUnit( T record, T commandRecord ) { assertEquals( "Secondary unit requirements should be the same", record.requiresSecondaryUnit(), commandRecord.requiresSecondaryUnit() ); assertEquals( "Secondary unit ids should be the same", record.getSecondaryUnitId(), commandRecord.getSecondaryUnitId() ); } }
if ( (!record.inUse() || !record.requiresSecondaryUnit()) && record.hasSecondaryUnitId() )
private void track( RecordStore<?> store, AbstractBaseRecord record ) { long id = max( record.getId(), record.requiresSecondaryUnit() ? record.getSecondaryUnitId() : -1 ); HighId highId = highIds.get( store ); if ( highId == null ) { highIds.put( store, new HighId( id ) ); } else { highId.track( id ); } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
") collides with format-generic header bits"; headerByte = set( headerByte, IN_USE_BIT, record.inUse() ); headerByte = set( headerByte, HEADER_BIT_RECORD_UNIT, record.requiresSecondaryUnit() ); if ( record.requiresSecondaryUnit() ) if ( record.requiresSecondaryUnit() )
") collides with format-generic header bits"; headerByte = set( headerByte, IN_USE_BIT, record.inUse() ); headerByte = set( headerByte, HEADER_BIT_RECORD_UNIT, record.requiresSecondaryUnit() ); if ( record.requiresSecondaryUnit() ) if ( record.requiresSecondaryUnit() )
") collides with format-generic header bits"; headerByte = set( headerByte, IN_USE_BIT, record.inUse() ); headerByte = set( headerByte, HEADER_BIT_RECORD_UNIT, record.requiresSecondaryUnit() ); if ( record.requiresSecondaryUnit() ) if ( record.requiresSecondaryUnit() )
") collides with format-generic header bits"; headerByte = set( headerByte, IN_USE_BIT, record.inUse() ); headerByte = set( headerByte, HEADER_BIT_RECORD_UNIT, record.requiresSecondaryUnit() ); if ( record.requiresSecondaryUnit() ) if ( record.requiresSecondaryUnit() )
") collides with format-generic header bits"; headerByte = set( headerByte, IN_USE_BIT, record.inUse() ); headerByte = set( headerByte, HEADER_BIT_RECORD_UNIT, record.requiresSecondaryUnit() ); headerByte = set( headerByte, HEADER_BIT_FIRST_RECORD_UNIT, true ); primaryCursor.putByte( headerByte ); if ( record.requiresSecondaryUnit() )
if ( (!record.inUse() || !record.requiresSecondaryUnit()) && record.hasSecondaryUnitId() )