Package com.google.gerrit.server.notedb
Class ChangeNotes.Factory
- java.lang.Object
-
- com.google.gerrit.server.notedb.ChangeNotes.Factory
-
- Enclosing class:
- ChangeNotes
public static class ChangeNotes.Factory extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChangeNotes.Factory.ChangeNotesResult
Result ofscan(Repository,Project.NameKey)
.
-
Constructor Summary
Constructors Constructor Description Factory(AbstractChangeNotes.Args args, com.google.inject.Provider<InternalChangeQuery> queryProvider, ProjectCache projectCache)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangeNotes
create(Change change, RefCache refs)
ChangeNotes
create(Project.NameKey project, Change.Id changeId)
ChangeNotes
create(Project.NameKey project, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaRevId)
List<ChangeNotes>
create(Project.NameKey project, Collection<Change.Id> changeIds, Predicate<ChangeNotes> predicate)
com.google.common.collect.ListMultimap<Project.NameKey,ChangeNotes>
create(Predicate<ChangeNotes> predicate)
ChangeNotes
create(org.eclipse.jgit.lib.Repository repository, Project.NameKey project, Change.Id changeId)
List<ChangeNotes>
create(org.eclipse.jgit.lib.Repository repo, Project.NameKey project, Collection<Change.Id> changeIds, Predicate<ChangeNotes> predicate)
ChangeNotes
createChecked(Change c)
ChangeNotes
createChecked(Project.NameKey project, Change.Id changeId)
ChangeNotes
createChecked(Project.NameKey project, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaRevId)
ChangeNotes
createChecked(org.eclipse.jgit.lib.Repository repo, Project.NameKey project, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaRevId)
Load the change-notes associated to a project/change-id using an existing open repositoryChangeNotes
createCheckedUsingIndexLookup(Change.Id changeId)
Create change notes based on aChange.Id
.ChangeNotes
createForBatchUpdate(Change change, boolean shouldExist)
ChangeNotes
createFromIndexedChange(Change change)
Create change notes for a change that was loaded from index.List<ChangeNotes>
createUsingIndexLookup(Collection<Change.Id> changeIds)
Create change notes based on a list ofChange.Id
s.static Change
newChange(Project.NameKey project, Change.Id changeId)
Stream<ChangeNotes.Factory.ChangeNotesResult>
scan(com.google.common.collect.ImmutableMap<Change.Id,org.eclipse.jgit.lib.ObjectId> metaIdByChange, Project.NameKey project, Predicate<Change.Id> changeIdPredicate)
Stream<ChangeNotes.Factory.ChangeNotesResult>
scan(org.eclipse.jgit.lib.Repository repo, Project.NameKey project)
Stream<ChangeNotes.Factory.ChangeNotesResult>
scan(org.eclipse.jgit.lib.Repository repo, Project.NameKey project, Predicate<Change.Id> changeIdPredicate)
static com.google.common.collect.ImmutableMap<Change.Id,org.eclipse.jgit.lib.ObjectId>
scanChangeIds(org.eclipse.jgit.lib.Repository repo)
-
-
-
Constructor Detail
-
Factory
@Inject public Factory(AbstractChangeNotes.Args args, com.google.inject.Provider<InternalChangeQuery> queryProvider, ProjectCache projectCache)
-
-
Method Detail
-
scanChangeIds
public static com.google.common.collect.ImmutableMap<Change.Id,org.eclipse.jgit.lib.ObjectId> scanChangeIds(org.eclipse.jgit.lib.Repository repo) throws IOException
- Throws:
IOException
-
createChecked
public ChangeNotes createChecked(Change c)
-
createChecked
public ChangeNotes createChecked(org.eclipse.jgit.lib.Repository repo, Project.NameKey project, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaRevId)
Load the change-notes associated to a project/change-id using an existing open repository- Parameters:
repo
- existing open repositoryproject
- project associated with the repositorychangeId
- change-id associated with the change-notes to loadmetaRevId
- version of the change-id to load, null for loading the latest- Returns:
- change-notes object for the change
-
createChecked
public ChangeNotes createChecked(Project.NameKey project, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaRevId)
-
createChecked
public ChangeNotes createChecked(Project.NameKey project, Change.Id changeId)
-
newChange
public static Change newChange(Project.NameKey project, Change.Id changeId)
-
create
public ChangeNotes create(Project.NameKey project, Change.Id changeId)
-
create
public ChangeNotes create(Project.NameKey project, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaRevId)
-
create
public ChangeNotes create(org.eclipse.jgit.lib.Repository repository, Project.NameKey project, Change.Id changeId)
-
createFromIndexedChange
public ChangeNotes createFromIndexedChange(Change change)
Create change notes for a change that was loaded from index. This method should only be used when database access is harmful and potentially stale data from the index is acceptable.- Parameters:
change
- change loaded from secondary index- Returns:
- change notes
-
createForBatchUpdate
public ChangeNotes createForBatchUpdate(Change change, boolean shouldExist)
-
create
public ChangeNotes create(Change change, RefCache refs)
-
createCheckedUsingIndexLookup
public ChangeNotes createCheckedUsingIndexLookup(Change.Id changeId)
Create change notes based on aChange.Id
. This requires using the Change index and should only be used whenProject.NameKey
and the numeric change ID are not available.
-
createUsingIndexLookup
public List<ChangeNotes> createUsingIndexLookup(Collection<Change.Id> changeIds)
Create change notes based on a list ofChange.Id
s. This requires using the Change index and should only be used whenProject.NameKey
and the numeric change ID are not available.
-
create
public List<ChangeNotes> create(org.eclipse.jgit.lib.Repository repo, Project.NameKey project, Collection<Change.Id> changeIds, Predicate<ChangeNotes> predicate)
-
create
public List<ChangeNotes> create(Project.NameKey project, Collection<Change.Id> changeIds, Predicate<ChangeNotes> predicate)
-
create
public com.google.common.collect.ListMultimap<Project.NameKey,ChangeNotes> create(Predicate<ChangeNotes> predicate) throws IOException
- Throws:
IOException
-
scan
public Stream<ChangeNotes.Factory.ChangeNotesResult> scan(org.eclipse.jgit.lib.Repository repo, Project.NameKey project) throws IOException
- Throws:
IOException
-
scan
public Stream<ChangeNotes.Factory.ChangeNotesResult> scan(org.eclipse.jgit.lib.Repository repo, Project.NameKey project, Predicate<Change.Id> changeIdPredicate) throws IOException
- Throws:
IOException
-
scan
public Stream<ChangeNotes.Factory.ChangeNotesResult> scan(com.google.common.collect.ImmutableMap<Change.Id,org.eclipse.jgit.lib.ObjectId> metaIdByChange, Project.NameKey project, Predicate<Change.Id> changeIdPredicate)
-
-