github.com/rohankumardubey/proxyfs@v0.0.0-20210108201508-653efa9ab00e/docs/source/architecture/uml/checkpoint.uml (about)

     1  @startuml
     2  
     3  title == Headhunter Checkpoint\n==== headhunter/api_swift.go::checkpointDaemon()
     4  
     5  start
     6  
     7  :set checkpointRequest = nil;
     8  
     9  repeat
    10    if (checkpointRequest == nil?) then (yes)
    11      :await either timer pop or explicit checkpointRequest;
    12      if (explicit checkpointRequedst?) then (yes)
    13        :set checkpointRequest = this request;
    14      else (no)
    15      endif
    16      :lock DB;
    17      if (available Nonce?) then (yes)
    18      else (no)
    19        :increment reservedToNonce;
    20        :compute new checkpointHeader using last successfully POST'd checkpointHeader;
    21        :HTTP POST new checkpointHeader;
    22        :unlock DB;
    23      endif
    24    else (no)
    25    endif
    26    if (didn't need to increment reservedToNonce?) then (yes)
    27      :consume next Nonce;
    28      if (needFullClone?) then (yes)
    29        :inodeRec B+Tree Touch();
    30        :logSegmentRec B+Tree Touch();
    31        :bPlusTreeObject B+Tree Touch();
    32      else (no)
    33      endif
    34      :inodeRec B+Tree Flush();
    35      :logSegmentRec B+Tree Flush();
    36      :bPlusTreeObject B+Tree Touch();
    37      :unlock DB;
    38      :HTTP (chunked) PUT Close();
    39      :await checkpointGateWaitGroup;
    40      :compute new checkpointHeader using Flush() return values;
    41      :HTTP POST new checkpointHeader;
    42      if (needFullClone?) then (yes)
    43        :launch checkpointCompactor()\n<i>asynchronously deletes all previous checkpoint objects now unreferenced</i>;
    44      else (no)
    45      endif
    46      :signal checkpointDoneWaitGroup;
    47    else (no)
    48    endif
    49  repeat while (not asked by checkpointRequest to exit?)
    50  
    51  stop
    52  
    53  @enduml