LCOV - code coverage report
Current view: top level - server/update - BatchUpdateListener.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 4 5 80.0 %
Date: 2022-11-19 15:00:39 Functions: 5 6 83.3 %

          Line data    Source code
       1             : // Copyright (C) 2017 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.server.update;
      16             : 
      17             : import org.eclipse.jgit.lib.BatchRefUpdate;
      18             : 
      19             : /**
      20             :  * Interface for listening during batch update execution.
      21             :  *
      22             :  * <p>When used during execution of multiple batch updates, the {@code after*} methods are called
      23             :  * after that phase has been completed for <em>all</em> updates.
      24             :  */
      25             : public interface BatchUpdateListener {
      26          53 :   BatchUpdateListener NONE = new BatchUpdateListener() {};
      27             : 
      28             :   /** Called after updating all repositories and flushing objects but before updating any refs. */
      29           0 :   default void afterUpdateRepos() throws Exception {}
      30             : 
      31             :   /**
      32             :    * Optional setup of the {@link BatchRefUpdate} that is going to be executed.
      33             :    *
      34             :    * <p>Called after {@link #afterUpdateRepos()}, before {@link #afterUpdateRefs()} and {@link
      35             :    * #afterUpdateChanges()}
      36             :    *
      37             :    * @param bru a batch ref update, ready but not executed yet
      38             :    * @return a new {@link BatchRefUpdate}. Implementations can decide to modify and return the
      39             :    *     incoming instance, but callers must not rely on that.
      40             :    */
      41             :   default BatchRefUpdate beforeUpdateRefs(BatchRefUpdate bru) {
      42          53 :     return bru;
      43             :   }
      44             : 
      45             :   /** Called after updating all refs. */
      46           1 :   default void afterUpdateRefs() throws Exception {}
      47             : 
      48             :   /** Called after updating all changes. */
      49           1 :   default void afterUpdateChanges() throws Exception {}
      50             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750