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 : /** 18 : * Base interface for operations performed as part of a {@link BatchUpdate}. 19 : * 20 : * <p>Operations that implement this type only touch the repository; they cannot touch change 21 : * storage, nor are they even associated with a change ID. To modify a change, implement {@link 22 : * BatchUpdateOp} instead. 23 : */ 24 : public interface RepoOnlyOp { 25 : /** 26 : * Override this method to update the repo. 27 : * 28 : * @param ctx context 29 : */ 30 97 : default void updateRepo(RepoContext ctx) throws Exception {} 31 : 32 : /** 33 : * Override this method to do something after the update e.g. send email or run hooks 34 : * 35 : * @param ctx context 36 : */ 37 : // TODO(dborowitz): Support async operations? 38 95 : default void postUpdate(PostUpdateContext ctx) throws Exception {} 39 : }