test_class.declarator: folder = new TemporaryFolder(new File("target"))
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryFolder folder = new TemporaryFolder(new File("target"));
test_class.type: TemporaryFolder
test_class.var_name: folder
test_class.declarator: fileStore
test_class.modifier: private
test_class.original_string: private FileStore fileStore;
test_class.type: FileStore
test_class.var_name: fileStore
test_class.declarator: nodeStore
test_class.modifier: private
test_class.original_string: private SegmentNodeStore nodeStore;
test_class.type: SegmentNodeStore
test_class.var_name: nodeStore
test_class.declarator: compactor
test_class.modifier: private
test_class.original_string: private CheckpointCompactor compactor;
test_class.type: CheckpointCompactor
test_class.var_name: compactor
test_class.declarator: compactedGeneration
test_class.modifier: private
test_class.original_string: private GCGeneration compactedGeneration;
test_class.type: GCGeneration
test_class.var_name: compactedGeneration
test_class.file: oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CheckpointCompactorTest.java
test_class.identifier: CheckpointCompactorTest
test_case.body: @Test
      public void testCompact() throws Exception {
          addTestContent("cp1", nodeStore, 42);
          String cp1 = nodeStore.checkpoint(DAYS.toMillis(1));
          addTestContent("cp2", nodeStore, 42);
          String cp2 = nodeStore.checkpoint(DAYS.toMillis(1));
  
          SegmentNodeState uncompacted1 = fileStore.getHead();
          SegmentNodeState compacted1 = compactor.compact(EMPTY_NODE, uncompacted1, EMPTY_NODE, Canceller.newCanceller());
          assertNotNull(compacted1);
          assertFalse(uncompacted1 == compacted1);
          checkGeneration(compacted1, compactedGeneration);
  
          assertSameStableId(uncompacted1, compacted1);
          assertSameStableId(getCheckpoint(uncompacted1, cp1), getCheckpoint(compacted1, cp1));
          assertSameStableId(getCheckpoint(uncompacted1, cp2), getCheckpoint(compacted1, cp2));
          assertSameRecord(getCheckpoint(compacted1, cp2), compacted1.getChildNode("root"));
  
          // Simulate a 2nd compaction cycle
          addTestContent("cp3", nodeStore, 42);
          String cp3 = nodeStore.checkpoint(DAYS.toMillis(1));
          addTestContent("cp4", nodeStore, 42);
          String cp4 = nodeStore.checkpoint(DAYS.toMillis(1));
  
          SegmentNodeState uncompacted2 = fileStore.getHead();
          SegmentNodeState compacted2 = compactor.compact(uncompacted1, uncompacted2, compacted1, Canceller.newCanceller());
          assertNotNull(compacted2);
          assertFalse(uncompacted2 == compacted2);
          checkGeneration(compacted2, compactedGeneration);
  
          assertTrue(fileStore.getRevisions().setHead(uncompacted2.getRecordId(), compacted2.getRecordId()));
  
          assertEquals(uncompacted2, compacted2);
          assertSameStableId(uncompacted2, compacted2);
          assertSameStableId(getCheckpoint(uncompacted2, cp1), getCheckpoint(compacted2, cp1));
          assertSameStableId(getCheckpoint(uncompacted2, cp2), getCheckpoint(compacted2, cp2));
          assertSameStableId(getCheckpoint(uncompacted2, cp3), getCheckpoint(compacted2, cp3));
          assertSameStableId(getCheckpoint(uncompacted2, cp4), getCheckpoint(compacted2, cp4));
          assertSameRecord(getCheckpoint(compacted1, cp1), getCheckpoint(compacted2, cp1));
          assertSameRecord(getCheckpoint(compacted1, cp2), getCheckpoint(compacted2, cp2));
          assertSameRecord(getCheckpoint(compacted2, cp4), compacted2.getChildNode("root"));
      }
test_case.class_method_signature: CheckpointCompactorTest.testCompact()
test_case.full_signature: @Test public void testCompact()
test_case.identifier: testCompact
test_case.invocations: addTestContent checkpoint toMillis addTestContent checkpoint toMillis getHead compact newCanceller assertNotNull assertFalse checkGeneration assertSameStableId assertSameStableId getCheckpoint getCheckpoint assertSameStableId getCheckpoint getCheckpoint assertSameRecord getCheckpoint getChildNode addTestContent checkpoint toMillis addTestContent checkpoint toMillis getHead compact newCanceller assertNotNull assertFalse checkGeneration assertTrue setHead getRevisions getRecordId getRecordId assertEquals assertSameStableId assertSameStableId getCheckpoint getCheckpoint assertSameStableId getCheckpoint getCheckpoint assertSameStableId getCheckpoint getCheckpoint assertSameStableId getCheckpoint getCheckpoint assertSameRecord getCheckpoint getCheckpoint assertSameRecord getCheckpoint getCheckpoint assertSameRecord getCheckpoint getChildNode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCompact()
focal_class.declarator: gcListener
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final GCMonitor gcListener;
focal_class.type: GCMonitor
focal_class.var_name: gcListener
focal_class.declarator: cpCache = newHashMap()
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final Map<NodeState, NodeState> cpCache = newHashMap();
focal_class.type: Map<NodeState, NodeState>
focal_class.var_name: cpCache
focal_class.declarator: compactor
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final ClassicCompactor compactor;
focal_class.type: ClassicCompactor
focal_class.var_name: compactor
focal_class.declarator: nodeWriter
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final NodeWriter nodeWriter;
focal_class.type: NodeWriter
focal_class.var_name: nodeWriter
focal_class.file: oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/CheckpointCompactor.java
focal_class.identifier: CheckpointCompactor
focal_class.interfaces: implements Compactor
focal_class.class_method_signature: CheckpointCompactor.CheckpointCompactor(
              @NotNull GCMonitor gcListener,
              @NotNull SegmentReader reader,
              @NotNull SegmentWriter writer,
              @Nullable BlobStore blobStore,
              @NotNull GCNodeWriteMonitor compactionMonitor)
focal_class.full_signature: public  CheckpointCompactor(
              @NotNull GCMonitor gcListener,
              @NotNull SegmentReader reader,
              @NotNull SegmentWriter writer,
              @Nullable BlobStore blobStore,
              @NotNull GCNodeWriteMonitor compactionMonitor)
focal_class.identifier: CheckpointCompactor
focal_class.modifiers: public
focal_class.parameters: (
              @NotNull GCMonitor gcListener,
              @NotNull SegmentReader reader,
              @NotNull SegmentWriter writer,
              @Nullable BlobStore blobStore,
              @NotNull GCNodeWriteMonitor compactionMonitor)
focal_class.signature:  CheckpointCompactor(
              @NotNull GCMonitor gcListener,
              @NotNull SegmentReader reader,
              @NotNull SegmentWriter writer,
              @Nullable BlobStore blobStore,
              @NotNull GCNodeWriteMonitor compactionMonitor)
focal_class.class_method_signature: CheckpointCompactor.compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.full_signature: @Override @Nullable public SegmentNodeState compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.identifier: compact
focal_class.modifiers: @Override @Nullable public
focal_class.parameters: (
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.return: SegmentNodeState
focal_class.signature: SegmentNodeState compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.class_method_signature: CheckpointCompactor.getStableIdBytes(@NotNull NodeState node)
focal_class.full_signature: @Nullable private static Buffer getStableIdBytes(@NotNull NodeState node)
focal_class.identifier: getStableIdBytes
focal_class.modifiers: @Nullable private static
focal_class.parameters: (@NotNull NodeState node)
focal_class.return: Buffer
focal_class.signature: Buffer getStableIdBytes(@NotNull NodeState node)
focal_class.class_method_signature: CheckpointCompactor.getRoot(@NotNull NodeState node)
focal_class.full_signature: @NotNull private static NodeState getRoot(@NotNull NodeState node)
focal_class.identifier: getRoot
focal_class.modifiers: @NotNull private static
focal_class.parameters: (@NotNull NodeState node)
focal_class.return: NodeState
focal_class.signature: NodeState getRoot(@NotNull NodeState node)
focal_class.class_method_signature: CheckpointCompactor.compact(
          @NotNull NodeState base,
          @NotNull LinkedHashMap<String, NodeState> uncompactedRoots,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.full_signature: @Nullable private LinkedHashMap<String, NodeState> compact(
          @NotNull NodeState base,
          @NotNull LinkedHashMap<String, NodeState> uncompactedRoots,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.identifier: compact
focal_class.modifiers: @Nullable private
focal_class.parameters: (
          @NotNull NodeState base,
          @NotNull LinkedHashMap<String, NodeState> uncompactedRoots,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.return: LinkedHashMap<String, NodeState>
focal_class.signature: LinkedHashMap<String, NodeState> compact(
          @NotNull NodeState base,
          @NotNull LinkedHashMap<String, NodeState> uncompactedRoots,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_class.class_method_signature: CheckpointCompactor.collectRoots(@Nullable NodeState superRoot)
focal_class.full_signature: @NotNull private LinkedHashMap<String, NodeState> collectRoots(@Nullable NodeState superRoot)
focal_class.identifier: collectRoots
focal_class.modifiers: @NotNull private
focal_class.parameters: (@Nullable NodeState superRoot)
focal_class.return: LinkedHashMap<String, NodeState>
focal_class.signature: LinkedHashMap<String, NodeState> collectRoots(@Nullable NodeState superRoot)
focal_class.class_method_signature: CheckpointCompactor.getChild(NodeBuilder builder, String path)
focal_class.full_signature: @NotNull private static NodeBuilder getChild(NodeBuilder builder, String path)
focal_class.identifier: getChild
focal_class.modifiers: @NotNull private static
focal_class.parameters: (NodeBuilder builder, String path)
focal_class.return: NodeBuilder
focal_class.signature: NodeBuilder getChild(NodeBuilder builder, String path)
focal_class.class_method_signature: CheckpointCompactor.compactWithCache(
          @NotNull NodeState before,
          @NotNull NodeState after,
          @NotNull NodeState onto,
          @NotNull String path,
          Canceller canceller
      )
focal_class.full_signature: @Nullable private Result compactWithCache(
          @NotNull NodeState before,
          @NotNull NodeState after,
          @NotNull NodeState onto,
          @NotNull String path,
          Canceller canceller
      )
focal_class.identifier: compactWithCache
focal_class.modifiers: @Nullable private
focal_class.parameters: (
          @NotNull NodeState before,
          @NotNull NodeState after,
          @NotNull NodeState onto,
          @NotNull String path,
          Canceller canceller
      )
focal_class.return: Result
focal_class.signature: Result compactWithCache(
          @NotNull NodeState before,
          @NotNull NodeState after,
          @NotNull NodeState onto,
          @NotNull String path,
          Canceller canceller
      )
focal_method.body: @Override
      @Nullable
      public SegmentNodeState compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      ) throws IOException {
          // Collect a chronologically ordered list of roots for the uncompacted
          // state. This list consists of all checkpoints followed by the root.
          LinkedHashMap<String, NodeState> uncompactedRoots = collectRoots(uncompacted);
  
          // Compact the list of uncompacted roots to a list of compacted roots.
          LinkedHashMap<String, NodeState> compactedRoots = compact(
              getRoot(base),
              uncompactedRoots,
              getRoot(onto),
              canceller
          );
  
          if (compactedRoots == null) {
              return null;
          }
  
          // Build a compacted super root by replacing the uncompacted roots with
          // the compacted ones in the original node.
          NodeBuilder builder = uncompacted.builder();
          for (Entry<String, NodeState> compactedRoot : compactedRoots.entrySet()) {
              String path = compactedRoot.getKey();
              NodeState state = compactedRoot.getValue();
              NodeBuilder childBuilder = getChild(builder, getParentPath(path));
              childBuilder.setChildNode(getName(path), state);
          }
  
          return nodeWriter.writeNode(builder.getNodeState(), getStableIdBytes(uncompacted));
      }
focal_method.class_method_signature: CheckpointCompactor.compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_method.full_signature: @Override @Nullable public SegmentNodeState compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_method.identifier: compact
focal_method.invocations: collectRoots compact getRoot getRoot builder entrySet getKey getValue getChild getParentPath setChildNode getName writeNode getNodeState getStableIdBytes
focal_method.modifiers: @Override @Nullable public
focal_method.parameters: (
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )
focal_method.return: SegmentNodeState
focal_method.signature: SegmentNodeState compact(
          @NotNull NodeState base,
          @NotNull NodeState uncompacted,
          @NotNull NodeState onto,
          Canceller canceller
      )