public class NoteDbUpdateManager extends Object implements AutoCloseable
Instances are one-time-use. Handles updating both the change repo and the All-Users repo for any affected changes, with proper ordering.
To see the state that would be applied prior to executing the full sequence of updates, use
stage()
.
Modifier and Type | Class and Description |
---|---|
static interface |
NoteDbUpdateManager.Factory |
static class |
NoteDbUpdateManager.MismatchedStateException |
static class |
NoteDbUpdateManager.OpenRepo |
static class |
NoteDbUpdateManager.Result |
static class |
NoteDbUpdateManager.StagedResult |
Modifier and Type | Field and Description |
---|---|
static String |
CHANGES_READ_ONLY |
Modifier and Type | Method and Description |
---|---|
void |
add(ChangeDraftUpdate draftUpdate) |
void |
add(ChangeUpdate update)
Add an update to the list of updates to execute.
|
void |
close() |
void |
deleteChange(Change.Id id) |
void |
execute() |
void |
flush() |
NoteDbUpdateManager.OpenRepo |
getAllUsersRepo() |
NoteDbUpdateManager.OpenRepo |
getChangeRepo() |
NoteDbUpdateManager |
setAllUsersRepo(org.eclipse.jgit.lib.Repository repo,
org.eclipse.jgit.revwalk.RevWalk rw,
org.eclipse.jgit.lib.ObjectInserter ins,
ChainedReceiveCommands cmds) |
NoteDbUpdateManager |
setChangeRepo(org.eclipse.jgit.lib.Repository repo,
org.eclipse.jgit.revwalk.RevWalk rw,
org.eclipse.jgit.lib.ObjectInserter ins,
ChainedReceiveCommands cmds) |
NoteDbUpdateManager |
setCheckExpectedState(boolean checkExpectedState) |
NoteDbUpdateManager |
setRefLogIdent(org.eclipse.jgit.lib.PersonIdent ident) |
NoteDbUpdateManager |
setRefLogMessage(String message) |
Map<Change.Id,NoteDbUpdateManager.StagedResult> |
stage()
Stage updates in the manager's internal list of commands.
|
NoteDbUpdateManager.Result |
stageAndApplyDelta(Change change) |
public static final String CHANGES_READ_ONLY
public void close()
close
in interface AutoCloseable
public NoteDbUpdateManager setChangeRepo(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, ChainedReceiveCommands cmds)
public NoteDbUpdateManager setAllUsersRepo(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, ChainedReceiveCommands cmds)
public NoteDbUpdateManager setCheckExpectedState(boolean checkExpectedState)
public NoteDbUpdateManager setRefLogMessage(String message)
public NoteDbUpdateManager setRefLogIdent(org.eclipse.jgit.lib.PersonIdent ident)
public NoteDbUpdateManager.OpenRepo getChangeRepo() throws IOException
IOException
public NoteDbUpdateManager.OpenRepo getAllUsersRepo() throws IOException
IOException
public void add(ChangeUpdate update)
Updates should only be added to the manager after all mutations have been made, as this method may eagerly access the update.
update
- the update to add.public void add(ChangeDraftUpdate draftUpdate)
public void deleteChange(Change.Id id)
public Map<Change.Id,NoteDbUpdateManager.StagedResult> stage() throws com.google.gwtorm.server.OrmException, IOException
com.google.gwtorm.server.OrmException
- if a database layer error occurs.IOException
- if a storage layer error occurs.public NoteDbUpdateManager.Result stageAndApplyDelta(Change change) throws com.google.gwtorm.server.OrmException, IOException
com.google.gwtorm.server.OrmException
IOException
public void flush() throws IOException
IOException
public void execute() throws com.google.gwtorm.server.OrmException, IOException
com.google.gwtorm.server.OrmException
IOException