Class ClassicCompactor


  • 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 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 segments
        compactionMonitor - 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 java.io.IOException
        Description copied from class: Compactor
        compact the differences between after and before on top of after.
        Specified by:
        compactDown in class Compactor
        Parameters:
        before - the node state to diff against from after
        after - the node state diffed against before
        hardCanceller - the trigger for hard cancellation, will abandon compaction if cancelled
        softCanceller - the trigger for soft cancellation, will return partially compacted state if cancelled
        Returns:
        the compacted node state or null if hard-cancelled
        Throws:
        java.io.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 java.io.IOException
        Description copied from class: Compactor
        compact the differences between after and before on top of onto.
        Specified by:
        compact in class Compactor
        Parameters:
        before - the node state to diff against from after
        after - the node state diffed against before
        onto - the node state to compact to apply the diff to
        canceller - the trigger for hard cancellation, will abandon compaction if cancelled
        Returns:
        the compacted node state or null if hard-cancelled
        Throws:
        java.io.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 java.io.IOException
        Throws:
        java.io.IOException