Class SimpleXStreamFlowNodeStorage

  • All Implemented Interfaces:
    org.jenkinsci.plugins.workflow.graph.FlowActionStorage

    public class SimpleXStreamFlowNodeStorage
    extends FlowNodeStorage
    FlowNodeStorage that stores one node per one file.
    Author:
    Kohsuke Kawaguchi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static XStream2 XSTREAM  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void autopersist​(org.jenkinsci.plugins.workflow.graph.FlowNode n)
      Flushes the node if needed, and if supported, marks it as needing to flush with EVERY write to the FlowNode.actions.
      void flush()
      Force persisting any nodes that had writing deferred
      void flushNode​(org.jenkinsci.plugins.workflow.graph.FlowNode n)
      Persists a single FlowNode to disk (if not already persisted).
      org.jenkinsci.plugins.workflow.graph.FlowNode getNode​(String id)  
      boolean isPersistedFully()
      Have we written everything to disk that we need to, or is there something waiting to be written
      List<Action> loadActions​(org.jenkinsci.plugins.workflow.graph.FlowNode node)  
      void saveActions​(org.jenkinsci.plugins.workflow.graph.FlowNode node, List<Action> actions)
      Just stores this one node, using the supplied actions.
      void storeNode​(org.jenkinsci.plugins.workflow.graph.FlowNode n)
      Registers node in this storage, potentially persisting to disk.
      void storeNode​(org.jenkinsci.plugins.workflow.graph.FlowNode n, boolean delayWritingActions)
      Register the given node to the storage, potentially flushing to disk, and optionally marking the node as deferring writes.
    • Field Detail

      • XSTREAM

        public static final XStream2 XSTREAM
    • Constructor Detail

      • SimpleXStreamFlowNodeStorage

        public SimpleXStreamFlowNodeStorage​(org.jenkinsci.plugins.workflow.flow.FlowExecution exec,
                                            File dir)
    • Method Detail

      • storeNode

        public void storeNode​(@NonNull
                              org.jenkinsci.plugins.workflow.graph.FlowNode n,
                              boolean delayWritingActions)
                       throws IOException
        Description copied from class: FlowNodeStorage
        Register the given node to the storage, potentially flushing to disk, and optionally marking the node as deferring writes.

        This should be invoked with delayWritingAction=true until you have a fully configured node to write out. Generally FlowNodeStorage.autopersist(FlowNode) should be automatically invoked before Step execution begins unless the step is block-scoped (in which case the FlowNode will handle this).

        Overrides:
        storeNode in class FlowNodeStorage
        Parameters:
        n - Node to store
        delayWritingActions - If true, node will avoid persisting actions except on explicit flush or when you call FlowNodeStorage.autopersist(FlowNode).
        Throws:
        IOException
      • autopersist

        public void autopersist​(@NonNull
                                org.jenkinsci.plugins.workflow.graph.FlowNode n)
                         throws IOException
        Description copied from class: FlowNodeStorage
        Flushes the node if needed, and if supported, marks it as needing to flush with EVERY write to the FlowNode.actions.
        Overrides:
        autopersist in class FlowNodeStorage
        Throws:
        IOException
      • flushNode

        public void flushNode​(@NonNull
                              org.jenkinsci.plugins.workflow.graph.FlowNode n)
                       throws IOException
        Persists a single FlowNode to disk (if not already persisted).
        Overrides:
        flushNode in class FlowNodeStorage
        Parameters:
        n - Node to persist
        Throws:
        IOException
      • saveActions

        public void saveActions​(@NonNull
                                org.jenkinsci.plugins.workflow.graph.FlowNode node,
                                @NonNull
                                List<Action> actions)
                         throws IOException
        Just stores this one node, using the supplied actions. GOTCHA: technically there's nothing ensuring that node.getActions() matches supplied actions.
        Throws:
        IOException
      • isPersistedFully

        public boolean isPersistedFully()
        Have we written everything to disk that we need to, or is there something waiting to be written
        Overrides:
        isPersistedFully in class FlowNodeStorage