com.torodb.backend.MetaDataReadInterface Maven / Gradle / Ivy
/*
* ToroDB
* Copyright © 2014 8Kdata Technology (www.8kdata.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package com.torodb.backend;
import com.google.common.collect.Lists;
import com.torodb.backend.tables.KvTable;
import com.torodb.backend.tables.MetaCollectionTable;
import com.torodb.backend.tables.MetaDatabaseTable;
import com.torodb.backend.tables.MetaDocPartIndexColumnTable;
import com.torodb.backend.tables.MetaDocPartIndexTable;
import com.torodb.backend.tables.MetaDocPartTable;
import com.torodb.backend.tables.MetaFieldTable;
import com.torodb.backend.tables.MetaIndexFieldTable;
import com.torodb.backend.tables.MetaIndexTable;
import com.torodb.backend.tables.MetaScalarTable;
import com.torodb.backend.tables.SemanticTable;
import com.torodb.backend.tables.records.KvRecord;
import com.torodb.backend.tables.records.MetaCollectionRecord;
import com.torodb.backend.tables.records.MetaDatabaseRecord;
import com.torodb.backend.tables.records.MetaDocPartIndexColumnRecord;
import com.torodb.backend.tables.records.MetaDocPartIndexRecord;
import com.torodb.backend.tables.records.MetaDocPartRecord;
import com.torodb.backend.tables.records.MetaFieldRecord;
import com.torodb.backend.tables.records.MetaIndexFieldRecord;
import com.torodb.backend.tables.records.MetaIndexRecord;
import com.torodb.backend.tables.records.MetaScalarRecord;
import com.torodb.core.TableRef;
import com.torodb.core.backend.MetaInfoKey;
import com.torodb.core.transaction.metainf.MetaCollection;
import com.torodb.core.transaction.metainf.MetaDatabase;
import com.torodb.core.transaction.metainf.MetaDocPart;
import org.jooq.DSLContext;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
public interface MetaDataReadInterface {
@Nonnull
MetaDatabaseTable getMetaDatabaseTable();
@Nonnull
MetaCollectionTable getMetaCollectionTable();
@Nonnull
> MetaDocPartTable getMetaDocPartTable();
@Nonnull
> MetaFieldTable getMetaFieldTable();
@Nonnull
> MetaScalarTable getMetaScalarTable();
@Nonnull
> MetaDocPartIndexTable getMetaDocPartIndexTable();
@Nonnull
@SuppressWarnings("checkstyle:LineLength")
> MetaDocPartIndexColumnTable getMetaDocPartIndexColumnTable();
@Nonnull
MetaIndexTable getMetaIndexTable();
@Nonnull
> MetaIndexFieldTable getMetaIndexFieldTable();
@Nonnull
KvTable getKvTable();
@Nonnull
Collection> getInternalFields(@Nonnull MetaDocPart metaDocPart);
@Nonnull
Collection> getInternalFields(@Nonnull TableRef tableRef);
@Nonnull
Collection> getPrimaryKeyInternalFields(@Nonnull TableRef tableRef);
@Nonnull
Collection> getReferenceInternalFields(@Nonnull TableRef tableRef);
@Nonnull
Collection> getForeignInternalFields(@Nonnull TableRef tableRef);
@Nonnull
Collection> getReadInternalFields(@Nonnull MetaDocPart metaDocPart);
@Nonnull
Collection> getReadInternalFields(@Nonnull TableRef tableRef);
long getDatabaseSize(@Nonnull DSLContext dsl, @Nonnull MetaDatabase database);
long getCollectionSize(@Nonnull DSLContext dsl, @Nonnull MetaDatabase database,
@Nonnull MetaCollection collection);
long getDocumentsSize(@Nonnull DSLContext dsl, @Nonnull MetaDatabase database,
@Nonnull MetaCollection collection);
Long getIndexSize(@Nonnull DSLContext dsl, @Nonnull MetaDatabase database,
@Nonnull MetaCollection collection, @Nonnull String index);
Optional readKv(@Nonnull DSLContext dsl, @Nonnull MetaInfoKey key);
Stream readMetaDatabaseTable(DSLContext dsl);
/**
*
* @return
*/
default List> getMetaTables() {
return Lists.newArrayList(
getKvTable(),
getMetaDocPartIndexColumnTable(),
getMetaDocPartIndexTable(),
getMetaIndexFieldTable(),
getMetaScalarTable(),
getMetaFieldTable(),
getMetaDocPartTable(),
getMetaIndexTable(),
getMetaCollectionTable(),
getMetaDatabaseTable()
);
}
}