Disable reading from changes tables under notedb
Wrap ReviewDb with an implementation that disables all read access methods on all Change-related tables. (Currently Changes itself is an exception because those calls have not all been migrated yet.) Change-Id: I60f585f5ef12c660aa9298c3676c1e5c95c945f4
This commit is contained in:

committed by
Edwin Kempin

parent
77d45ed0b2
commit
220a3f5d03
@@ -17,7 +17,12 @@ package com.google.gerrit.reviewdb.server;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.util.concurrent.CheckedFuture;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gwtorm.server.Access;
|
||||
import com.google.gwtorm.server.AtomicUpdate;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
@@ -257,8 +262,7 @@ public class ReviewDbWrapper implements ReviewDb {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Change atomicUpdate(Change.Id key, AtomicUpdate<Change> update)
|
||||
throws OrmException {
|
||||
public Change atomicUpdate(Change.Id key, AtomicUpdate<Change> update) throws OrmException {
|
||||
return delegate.atomicUpdate(key, update);
|
||||
}
|
||||
|
||||
@@ -272,4 +276,449 @@ public class ReviewDbWrapper implements ReviewDb {
|
||||
return delegate.all();
|
||||
}
|
||||
}
|
||||
|
||||
public static class PatchSetApprovalAccessWrapper
|
||||
implements PatchSetApprovalAccess {
|
||||
protected final PatchSetApprovalAccess delegate;
|
||||
|
||||
protected PatchSetApprovalAccessWrapper(PatchSetApprovalAccess delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelationName() {
|
||||
return delegate.getRelationName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelationID() {
|
||||
return delegate.getRelationID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSetApproval> iterateAllEntities()
|
||||
throws OrmException {
|
||||
return delegate.iterateAllEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchSetApproval.Key primaryKey(PatchSetApproval entity) {
|
||||
return delegate.primaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<PatchSetApproval.Key, PatchSetApproval> toMap(
|
||||
Iterable<PatchSetApproval> c) {
|
||||
return delegate.toMap(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckedFuture<PatchSetApproval, OrmException> getAsync(
|
||||
PatchSetApproval.Key key) {
|
||||
return delegate.getAsync(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSetApproval> get(Iterable<PatchSetApproval.Key> keys)
|
||||
throws OrmException {
|
||||
return delegate.get(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Iterable<PatchSetApproval> instances)
|
||||
throws OrmException {
|
||||
delegate.insert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Iterable<PatchSetApproval> instances)
|
||||
throws OrmException {
|
||||
delegate.update(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upsert(Iterable<PatchSetApproval> instances)
|
||||
throws OrmException {
|
||||
delegate.upsert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteKeys(Iterable<PatchSetApproval.Key> keys)
|
||||
throws OrmException {
|
||||
delegate.deleteKeys(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Iterable<PatchSetApproval> instances)
|
||||
throws OrmException {
|
||||
delegate.delete(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginTransaction(PatchSetApproval.Key key) throws OrmException {
|
||||
delegate.beginTransaction(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchSetApproval atomicUpdate(PatchSetApproval.Key key,
|
||||
AtomicUpdate<PatchSetApproval> update) throws OrmException {
|
||||
return delegate.atomicUpdate(key, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchSetApproval get(PatchSetApproval.Key key) throws OrmException {
|
||||
return delegate.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSetApproval> byChange(Change.Id id)
|
||||
throws OrmException {
|
||||
return delegate.byChange(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSetApproval> byPatchSet(PatchSet.Id id)
|
||||
throws OrmException {
|
||||
return delegate.byPatchSet(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSetApproval> byPatchSetUser(PatchSet.Id patchSet,
|
||||
Account.Id account) throws OrmException {
|
||||
return delegate.byPatchSetUser(patchSet, account);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ChangeMessageAccessWrapper
|
||||
implements ChangeMessageAccess {
|
||||
protected final ChangeMessageAccess delegate;
|
||||
|
||||
protected ChangeMessageAccessWrapper(ChangeMessageAccess delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelationName() {
|
||||
return delegate.getRelationName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelationID() {
|
||||
return delegate.getRelationID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<ChangeMessage> iterateAllEntities() throws OrmException {
|
||||
return delegate.iterateAllEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeMessage.Key primaryKey(ChangeMessage entity) {
|
||||
return delegate.primaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ChangeMessage.Key, ChangeMessage> toMap(
|
||||
Iterable<ChangeMessage> c) {
|
||||
return delegate.toMap(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckedFuture<ChangeMessage, OrmException> getAsync(
|
||||
ChangeMessage.Key key) {
|
||||
return delegate.getAsync(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<ChangeMessage> get(Iterable<ChangeMessage.Key> keys)
|
||||
throws OrmException {
|
||||
return delegate.get(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Iterable<ChangeMessage> instances) throws OrmException {
|
||||
delegate.insert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Iterable<ChangeMessage> instances) throws OrmException {
|
||||
delegate.update(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upsert(Iterable<ChangeMessage> instances) throws OrmException {
|
||||
delegate.upsert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteKeys(Iterable<ChangeMessage.Key> keys)
|
||||
throws OrmException {
|
||||
delegate.deleteKeys(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Iterable<ChangeMessage> instances) throws OrmException {
|
||||
delegate.delete(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginTransaction(ChangeMessage.Key key) throws OrmException {
|
||||
delegate.beginTransaction(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeMessage atomicUpdate(ChangeMessage.Key key,
|
||||
AtomicUpdate<ChangeMessage> update) throws OrmException {
|
||||
return delegate.atomicUpdate(key, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeMessage get(ChangeMessage.Key id) throws OrmException {
|
||||
return delegate.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<ChangeMessage> byChange(Change.Id id) throws OrmException {
|
||||
return delegate.byChange(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<ChangeMessage> byPatchSet(PatchSet.Id id)
|
||||
throws OrmException {
|
||||
return delegate.byPatchSet(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<ChangeMessage> all() throws OrmException {
|
||||
return delegate.all();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PatchSetAccessWrapper implements PatchSetAccess {
|
||||
protected final PatchSetAccess delegate;
|
||||
|
||||
protected PatchSetAccessWrapper(PatchSetAccess delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelationName() {
|
||||
return delegate.getRelationName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelationID() {
|
||||
return delegate.getRelationID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSet> iterateAllEntities() throws OrmException {
|
||||
return delegate.iterateAllEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchSet.Id primaryKey(PatchSet entity) {
|
||||
return delegate.primaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<PatchSet.Id, PatchSet> toMap(Iterable<PatchSet> c) {
|
||||
return delegate.toMap(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckedFuture<PatchSet, OrmException> getAsync(PatchSet.Id key) {
|
||||
return delegate.getAsync(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSet> get(Iterable<PatchSet.Id> keys)
|
||||
throws OrmException {
|
||||
return delegate.get(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Iterable<PatchSet> instances) throws OrmException {
|
||||
delegate.insert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Iterable<PatchSet> instances) throws OrmException {
|
||||
delegate.update(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upsert(Iterable<PatchSet> instances) throws OrmException {
|
||||
delegate.upsert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteKeys(Iterable<PatchSet.Id> keys) throws OrmException {
|
||||
delegate.deleteKeys(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Iterable<PatchSet> instances) throws OrmException {
|
||||
delegate.delete(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginTransaction(PatchSet.Id key) throws OrmException {
|
||||
delegate.beginTransaction(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchSet atomicUpdate(PatchSet.Id key, AtomicUpdate<PatchSet> update)
|
||||
throws OrmException {
|
||||
return delegate.atomicUpdate(key, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchSet get(PatchSet.Id id) throws OrmException {
|
||||
return delegate.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchSet> byChange(Change.Id id) throws OrmException {
|
||||
return delegate.byChange(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PatchLineCommentAccessWrapper
|
||||
implements PatchLineCommentAccess {
|
||||
protected PatchLineCommentAccess delegate;
|
||||
|
||||
protected PatchLineCommentAccessWrapper(PatchLineCommentAccess delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelationName() {
|
||||
return delegate.getRelationName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelationID() {
|
||||
return delegate.getRelationID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> iterateAllEntities()
|
||||
throws OrmException {
|
||||
return delegate.iterateAllEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchLineComment.Key primaryKey(PatchLineComment entity) {
|
||||
return delegate.primaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<PatchLineComment.Key, PatchLineComment> toMap(
|
||||
Iterable<PatchLineComment> c) {
|
||||
return delegate.toMap(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckedFuture<PatchLineComment, OrmException> getAsync(
|
||||
PatchLineComment.Key key) {
|
||||
return delegate.getAsync(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> get(Iterable<PatchLineComment.Key> keys)
|
||||
throws OrmException {
|
||||
return delegate.get(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Iterable<PatchLineComment> instances)
|
||||
throws OrmException {
|
||||
delegate.insert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Iterable<PatchLineComment> instances)
|
||||
throws OrmException {
|
||||
delegate.update(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upsert(Iterable<PatchLineComment> instances)
|
||||
throws OrmException {
|
||||
delegate.upsert(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteKeys(Iterable<PatchLineComment.Key> keys)
|
||||
throws OrmException {
|
||||
delegate.deleteKeys(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Iterable<PatchLineComment> instances)
|
||||
throws OrmException {
|
||||
delegate.delete(instances);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginTransaction(PatchLineComment.Key key) throws OrmException {
|
||||
delegate.beginTransaction(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchLineComment atomicUpdate(PatchLineComment.Key key,
|
||||
AtomicUpdate<PatchLineComment> update) throws OrmException {
|
||||
return delegate.atomicUpdate(key, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PatchLineComment get(PatchLineComment.Key id) throws OrmException {
|
||||
return delegate.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> byChange(Change.Id id)
|
||||
throws OrmException {
|
||||
return delegate.byChange(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> byPatchSet(PatchSet.Id id)
|
||||
throws OrmException {
|
||||
return delegate.byPatchSet(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> publishedByChangeFile(Change.Id id,
|
||||
String file) throws OrmException {
|
||||
return delegate.publishedByChangeFile(id, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> publishedByPatchSet(PatchSet.Id patchset)
|
||||
throws OrmException {
|
||||
return delegate.publishedByPatchSet(patchset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> draftByPatchSetAuthor(
|
||||
PatchSet.Id patchset, Account.Id author) throws OrmException {
|
||||
return delegate.draftByPatchSetAuthor(patchset, author);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> draftByChangeFileAuthor(Change.Id id,
|
||||
String file, Account.Id author) throws OrmException {
|
||||
return delegate.draftByChangeFileAuthor(id, file, author);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet<PatchLineComment> draftByAuthor(Account.Id author)
|
||||
throws OrmException {
|
||||
return delegate.draftByAuthor(author);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user