use of com.torodb.core.transaction.metainf.MutableMetaCollection in project torodb by torodb.
the class D2RTranslationBatchFunctionTest method setUp.
@Before
public void setUp() {
metaDb = new WrapperMutableMetaDatabase(new ImmutableMetaDatabase("dbName", "dbId", Collections.emptyList()), (o) -> {
});
metaCol = metaDb.addMetaCollection("colName", "colId");
translatorFactory = mock(D2RTranslatorFactory.class);
fun = new D2RTranslationBatchFunction(translatorFactory, metaDb, metaCol) {
@Override
protected BatchMetaCollection createMetaDocCollection(MutableMetaCollection metaCol) {
batchMetaCol = spy(super.createMetaDocCollection(metaCol));
return batchMetaCol;
}
};
}
use of com.torodb.core.transaction.metainf.MutableMetaCollection in project torodb by torodb.
the class SqlExclusiveWriteTorodTransaction method renameCollection.
@Override
public void renameCollection(String fromDb, String fromCollection, String toDb, String toCollection) throws RollbackException, UserException {
MutableMetaDatabase fromMetaDb = getMetaDatabaseOrThrowException(fromDb);
MetaCollection fromMetaColl = getMetaCollectionOrThrowException(fromMetaDb, fromCollection);
MutableMetaDatabase toMetaDb = getOrCreateMetaDatabase(toDb);
MutableMetaCollection toMetaColl = createMetaCollection(toMetaDb, toCollection);
getInternalTransaction().getBackendTransaction().renameCollection(fromMetaDb, fromMetaColl, toMetaDb, toMetaColl);
fromMetaDb.removeMetaCollectionByName(fromCollection);
}
use of com.torodb.core.transaction.metainf.MutableMetaCollection in project torodb by torodb.
the class SqlWriteTorodTransaction method insert.
@Override
public void insert(String db, String collection, Stream<KvDocument> documents) throws RollbackException, UserException {
Preconditions.checkState(!isClosed());
MutableMetaDatabase metaDb = getOrCreateMetaDatabase(db);
MutableMetaCollection metaCol = getOrCreateMetaCollection(metaDb, collection);
//TODO: here we can not use a pipeline
InsertPipeline pipeline = getConnection().getServer().getInsertPipelineFactory().createInsertPipeline(getConnection().getServer().getD2RTranslatorFactory(), metaDb, metaCol, getInternalTransaction().getBackendTransaction(), concurrent);
pipeline.insert(documents);
}
Aggregations