Class BatchUpdate

  • All Implemented Interfaces:
    AutoCloseable
    Direct Known Subclasses:
    NoteDbBatchUpdate, ReviewDbBatchUpdate

    public abstract class BatchUpdate
    extends Object
    implements AutoCloseable
    Helper for a set of updates that should be applied for a site.

    An update operation can be divided into three phases:

    1. Git reference updates
    2. Database updates
    3. Post-update steps
    A single conceptual operation, such as a REST API call or a merge operation, may make multiple changes at each step, which all need to be serialized relative to each other. Moreover, for consistency, all git ref updates must be performed before any database updates, since database updates might refer to newly-created patch set refs. And all post-update steps, such as hooks, should run only after all storage mutations have completed.

    Depending on the backend used, each step might support batching, for example in a BatchRefUpdate or one or more database transactions. All operations in one phase must complete successfully before proceeding to the next phase.