Class ClassicCompactor
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.Compactor
-
- org.apache.jackrabbit.oak.segment.ClassicCompactor
-
- Direct Known Subclasses:
ParallelCompactor
public class ClassicCompactor extends Compactor
Instances of this class can be used to compact a node state. I.e. to create a clone of a given node state without value sharing except for binaries. Binaries that are stored in a list of bulk segments will still value share the bulk segments (but not the list records). A node can either be compacted on its own or alternatively the difference between two nodes can be compacted on top of an already compacted node.
-
-
Constructor Summary
Constructors Constructor Description ClassicCompactor(@NotNull CompactionWriter writer, @NotNull GCNodeWriteMonitor compactionMonitor)Create a new instance based on the passed arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected @NotNull PropertyStatecompact(@NotNull PropertyState property)@Nullable CompactedNodeStatecompact(@NotNull NodeState before, @NotNull NodeState after, @NotNull NodeState onto, @NotNull Canceller canceller)compact the differences betweenafterandbeforeon top ofonto.protected @Nullable CompactedNodeStatecompact(@NotNull NodeState before, @NotNull NodeState after, @NotNull NodeState onto, @NotNull Canceller hardCanceller, @Nullable Canceller softCanceller)Compact the differences betweenafterandbeforeon top ofonto.@Nullable CompactedNodeStatecompactDown(@NotNull NodeState before, @NotNull NodeState after, @NotNull Canceller hardCanceller, @NotNull Canceller softCanceller)compact the differences betweenafterandbeforeon top ofafter.protected @Nullable CompactedNodeStategetPreviouslyCompactedState(NodeState nodeState)protected @Nullable CompactedNodeStatewriteNodeState(@NotNull NodeState nodeState, @Nullable Buffer stableIdBytes, boolean complete)-
Methods inherited from class org.apache.jackrabbit.oak.segment.Compactor
compactDown, compactUp, compactUp
-
-
-
-
Constructor Detail
-
ClassicCompactor
public ClassicCompactor(@NotNull @NotNull CompactionWriter writer, @NotNull @NotNull GCNodeWriteMonitor compactionMonitor)Create a new instance based on the passed arguments.- Parameters:
writer- segment writer used to serialise to segmentscompactionMonitor- notification call back for each compacted nodes, properties, and binaries
-
-
Method Detail
-
compactDown
@Nullable public @Nullable CompactedNodeState compactDown(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull Canceller hardCanceller, @NotNull @NotNull Canceller softCanceller) throws IOException
Description copied from class:Compactorcompact the differences betweenafterandbeforeon top ofafter.- Specified by:
compactDownin classCompactor- Parameters:
before- the node state to diff against fromafterafter- the node state diffed againstbeforehardCanceller- the trigger for hard cancellation, will abandon compaction if cancelledsoftCanceller- the trigger for soft cancellation, will return partially compacted state if cancelled- Returns:
- the compacted node state or
nullif hard-cancelled - Throws:
IOException- will throw exception if any errors occur during compaction
-
compact
@Nullable public @Nullable CompactedNodeState compact(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull NodeState onto, @NotNull @NotNull Canceller canceller) throws IOException
Description copied from class:Compactorcompact the differences betweenafterandbeforeon top ofonto.- Specified by:
compactin classCompactor- Parameters:
before- the node state to diff against fromafterafter- the node state diffed againstbeforeonto- the node state to compact to apply the diff tocanceller- the trigger for hard cancellation, will abandon compaction if cancelled- Returns:
- the compacted node state or
nullif hard-cancelled - Throws:
IOException- will throw exception if any errors occur during compaction
-
compact
@Nullable protected @Nullable CompactedNodeState compact(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull NodeState onto, @NotNull @NotNull Canceller hardCanceller, @Nullable @Nullable Canceller softCanceller) throws IOException
Compact the differences betweenafterandbeforeon top ofonto. ThesoftCancellermust be null, unlessafter.equals(onto), i.e. if the method is called for acompactDown(NodeState, NodeState, Canceller, Canceller)scenario. .- Parameters:
before- The node state used as the baseline for the diff.after- The node state used as the target for the diff.onto- The node state to apply the diff to.hardCanceller- The trigger for hard cancellation, will abandon compaction if cancelled.softCanceller- The trigger for soft cancellation, will return partially compacted state if cancelled. Must be null unlessafter.equals(onto).- Returns:
- The compacted node state or
nullif hard-cancelled. - Throws:
IOException- Will throw exception if any errors occur during compaction.
-
writeNodeState
@Nullable protected @Nullable CompactedNodeState writeNodeState(@NotNull @NotNull NodeState nodeState, @Nullable @Nullable Buffer stableIdBytes, boolean complete) throws IOException
- Throws:
IOException
-
getPreviouslyCompactedState
@Nullable protected @Nullable CompactedNodeState getPreviouslyCompactedState(NodeState nodeState)
-
compact
@NotNull protected @NotNull PropertyState compact(@NotNull @NotNull PropertyState property)
-
-