Record the number of updates to a NoteDb ref

Eventually we may want to limit the total length of a NoteDb ref's
history, to avoid having to scan and store an unbounded amount of commit
data into ChangeNotes. To do that, we first need to record it.

In most cases, this number will equal getChangeMessages().size(), but
that's partly an artifact of the current APIs, which always accompany a
change with a ChangeMessage. The underlying storage layer doesn't
require it.

Don't bump the ChangeNotesCache version number: old entries will just
return an update count of 0. My current thinking is that populating this
field is not worth flushing the persistent cache. If we change our
minds, we can trivially bump the version number.

Change-Id: I9fbcdfa0583a525e60b75672032f3179e5da3c79
This commit is contained in:
Dave Borowitz
2019-04-15 14:33:22 -07:00
parent 9137bc454a
commit 10edb7cad8
7 changed files with 59 additions and 7 deletions

View File

@@ -418,6 +418,10 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
return commentKeys;
}
public int getUpdateCount() {
return state.updateCount();
}
public ImmutableListMultimap<RevId, Comment> getDraftComments(Account.Id author) {
return getDraftComments(author, null);
}