@Override public void startObject(long oid, int prevSchemaVersion) { if (posIndex == null) { if (schemaIndexEntry == null) { schemaIndexEntry = schemaIndex.getSchema(def); } posIndex = schemaIndexEntry.getObjectIndexLatestSchemaVersion(); } PagedPosIndex prevIndex = schemaIndexEntry.getObjectIndexVersion(prevSchemaVersion); currentPage = out.getPage(); currentOffs = out.getOffset(); // first remove possible previous position final LongLongIndex.LLEntry objPos = oidIndex.findOidGetLong(oid); if (objPos != null) { long pos = objPos.getValue(); // long with 32=page + 32=offs // prevPos.getValue() returns > 0, so the loop is performed at least once. do { // remove and report to FSM if applicable // TODO // In cache, use separate list for evolved objects to be written (Map<PC/OID, // OriginalClassDef) // Do not put those objects in dirty-list // When checking for dirty (external) return whether contained in dirty-list. // When...??? long nextPos = prevIndex.removePosLongAndCheck(pos); // all secondary pages are marked. nextPos |= PagedPosIndex.MARK_SECONDARY; pos = nextPos; } while (pos != PagedPosIndex.MARK_SECONDARY); } // Update pos index oidIndex.insertLong(oid, currentPage, (int) currentOffs); }
@Override public void notifyOverflowWrite(int newPage) { // Update pos index posIndex.addPos(currentPage, currentOffs, newPage); currentPage = newPage; currentOffs = PagedPosIndex.MARK_SECONDARY; }
@Override public void finishObject() { posIndex.addPos(currentPage, currentOffs, 0); }