Add All-Users project to store meta data for all users
This change adds a migration that creates an All-Users project for storing meta data for all users. With this change no data is stored in this repository yet, but future changes will e.g. store user preferences in this repository by creating a ref per user. Change-Id: Ib1ba5e4c2fb7a2f8e49d3bcf994c99d9e911475c Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.cache.CacheModule;
|
||||
import com.google.gerrit.server.config.AllProjectsName;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.ProjectConfig;
|
||||
import com.google.inject.Inject;
|
||||
@@ -74,6 +75,7 @@ public class ProjectCacheImpl implements ProjectCache {
|
||||
}
|
||||
|
||||
private final AllProjectsName allProjectsName;
|
||||
private final AllUsersName allUsersName;
|
||||
private final LoadingCache<String, ProjectState> byName;
|
||||
private final LoadingCache<ListKey, SortedSet<Project.NameKey>> list;
|
||||
private final Lock listLock;
|
||||
@@ -82,10 +84,12 @@ public class ProjectCacheImpl implements ProjectCache {
|
||||
@Inject
|
||||
ProjectCacheImpl(
|
||||
final AllProjectsName allProjectsName,
|
||||
final AllUsersName allUsersName,
|
||||
@Named(CACHE_NAME) LoadingCache<String, ProjectState> byName,
|
||||
@Named(CACHE_LIST) LoadingCache<ListKey, SortedSet<Project.NameKey>> list,
|
||||
ProjectCacheClock clock) {
|
||||
this.allProjectsName = allProjectsName;
|
||||
this.allUsersName = allUsersName;
|
||||
this.byName = byName;
|
||||
this.list = list;
|
||||
this.listLock = new ReentrantLock(true /* fair */);
|
||||
@@ -103,6 +107,16 @@ public class ProjectCacheImpl implements ProjectCache {
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectState getAllUsers() {
|
||||
ProjectState state = get(allUsersName);
|
||||
if (state == null) {
|
||||
// This should never occur.
|
||||
throw new IllegalStateException("Missing project " + allUsersName);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectState get(final Project.NameKey projectName) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user