public class NoteDbChangeState extends Object
Stored serialized in the Change#noteDbState
field, and used to determine whether the
state in NoteDb is out of date.
Serialized in one of the forms:
Modifier and Type | Class and Description |
---|---|
static class |
NoteDbChangeState.Delta |
static class |
NoteDbChangeState.PrimaryStorage |
static class |
NoteDbChangeState.RefState |
Modifier and Type | Field and Description |
---|---|
static String |
NOTE_DB_PRIMARY_STATE |
Constructor and Description |
---|
NoteDbChangeState(Change.Id changeId,
NoteDbChangeState.PrimaryStorage primaryStorage,
Optional<NoteDbChangeState.RefState> refState,
Optional<Timestamp> readOnlyUntil) |
public static final String NOTE_DB_PRIMARY_STATE
public NoteDbChangeState(Change.Id changeId, NoteDbChangeState.PrimaryStorage primaryStorage, Optional<NoteDbChangeState.RefState> refState, Optional<Timestamp> readOnlyUntil)
public static NoteDbChangeState parse(Change c)
public static NoteDbChangeState parse(Change.Id id, String str)
public static NoteDbChangeState applyDelta(Change change, NoteDbChangeState.Delta delta)
This method does not check whether the old state was read-only; it is up to the caller to not violate read-only semantics when storing the change back in ReviewDb.
change
- change entity. The delta is applied against this entity's noteDbState
and
the new state is stored back in the entity as a side effect.delta
- delta to apply.change
as a side effect.public static boolean isChangeUpToDate(NoteDbChangeState state, RefCache changeRepoRefs, Change.Id changeId) throws IOException
IOException
public static boolean areDraftsUpToDate(NoteDbChangeState state, RefCache draftsRepoRefs, Change.Id changeId, Account.Id accountId) throws IOException
IOException
public static long getReadOnlySkew(org.eclipse.jgit.lib.Config cfg)
public static void checkNotReadOnly(Change change, long skewMs)
public static void checkNotReadOnly(NoteDbChangeState state, long skewMs)
public NoteDbChangeState.PrimaryStorage getPrimaryStorage()
public boolean isChangeUpToDate(RefCache changeRepoRefs) throws IOException
IOException
public boolean areDraftsUpToDate(RefCache draftsRepoRefs, Account.Id accountId) throws IOException
IOException
public boolean isUpToDate(RefCache changeRepoRefs, RefCache draftsRepoRefs) throws IOException
IOException
public boolean isReadOnly(Timestamp now)
public NoteDbChangeState withReadOnlyUntil(Timestamp ts)
public Change.Id getChangeId()
public org.eclipse.jgit.lib.ObjectId getChangeMetaId()
public com.google.common.collect.ImmutableMap<Account.Id,org.eclipse.jgit.lib.ObjectId> getDraftIds()
public Optional<NoteDbChangeState.RefState> getRefState()