use of herddb.model.Record in project herddb by diennea.
the class SysindexcolumnsTableManager method buildVirtualRecordList.
@Override
protected Iterable<Record> buildVirtualRecordList(Transaction transaction) {
List<Table> tables = tableSpaceManager.getAllVisibleTables(transaction);
List<Record> result = new ArrayList<>();
tables.forEach(r -> {
// PK
int posPk = 0;
for (String pk : r.getPrimaryKey()) {
Column column = r.getColumn(pk);
String indexName = BLinkKeyToPageIndex.deriveIndexName(r.name);
result.add(RecordSerializer.makeRecord(table, "index_type", "pk", "column_name", column.name, "ordinal_position", posPk++, "clustered", 1, "unique", 1, "tablespace", r.tablespace, "table_name", r.name, "index_name", indexName, // uuid = index_name in BLink !
"index_uuid", // uuid = index_name in BLink !
indexName));
}
Map<String, AbstractIndexManager> indexesOnTable = tableSpaceManager.getIndexesOnTable(r.name);
if (indexesOnTable != null) {
indexesOnTable.values().forEach(indexManager -> {
Index index = indexManager.getIndex();
int pos = 0;
for (Column cc : index.getColumns()) {
result.add(RecordSerializer.makeRecord(table, "tablespace", r.tablespace, "table_name", r.name, "index_name", index.name, "index_uuid", index.uuid, "index_type", index.type, "column_name", cc.name, "ordinal_position", pos++, "clustered", 0, "unique", index.unique ? 1 : 0));
}
});
}
});
return result;
}
use of herddb.model.Record in project herddb by diennea.
the class SysstatementsTableManager method buildVirtualRecordList.
@Override
protected Iterable<Record> buildVirtualRecordList(Transaction transaction) {
ConcurrentHashMap<Long, RunningStatementInfo> runningStatements = tableSpaceManager.getDbmanager().getRunningStatements().getRunningStatements();
List<Record> result = new ArrayList<>();
long now = System.currentTimeMillis();
for (RunningStatementInfo info : runningStatements.values()) {
result.add(RecordSerializer.makeRecord(table, "id", info.getId(), "tablespace", info.getTablespace(), "query", info.getQuery(), "startts", new java.sql.Timestamp(info.getStartTimestamp()), "runningtime", (now - info.getStartTimestamp()), "batches", info.getNumBatches(), "info", info.getInfo()));
}
return result;
}
use of herddb.model.Record in project herddb by diennea.
the class SysnodesTableManager method buildVirtualRecordList.
@Override
protected Iterable<Record> buildVirtualRecordList(Transaction transaction) throws StatementExecutionException {
try {
Collection<NodeMetadata> nodes = tableSpaceManager.getMetadataStorageManager().listNodes();
List<Record> result = new ArrayList<>();
for (NodeMetadata t : nodes) {
result.add(RecordSerializer.makeRecord(table, "nodeid", t.nodeId, "address", t.host + ":" + t.port, "ssl", t.ssl ? 1 : 0));
}
return result;
} catch (MetadataStorageManagerException error) {
throw new StatementExecutionException(error);
}
}
use of herddb.model.Record in project herddb by diennea.
the class SystablespacesTableManager method buildVirtualRecordList.
@Override
protected Iterable<Record> buildVirtualRecordList(Transaction transaction) throws StatementExecutionException {
try {
Collection<String> names = tableSpaceManager.getMetadataStorageManager().listTableSpaces();
List<Record> result = new ArrayList<>();
for (String name : names) {
TableSpace t = tableSpaceManager.getMetadataStorageManager().describeTableSpace(name);
if (t != null) {
result.add(RecordSerializer.makeRecord(table, "tablespace_name", t.name, "uuid", t.uuid, "leader", t.leaderId, "expectedreplicacount", t.expectedReplicaCount, "maxleaderinactivitytime", t.maxLeaderInactivityTime, "replica", t.replicas.stream().collect(Collectors.joining(","))));
}
}
return result;
} catch (MetadataStorageManagerException error) {
throw new StatementExecutionException(error);
}
}
use of herddb.model.Record in project herddb by diennea.
the class SystransactionsTableManager method buildVirtualRecordList.
@Override
protected Iterable<Record> buildVirtualRecordList(Transaction transaction) {
List<Transaction> transactions = tableSpaceManager.getTransactions();
List<Record> result = new ArrayList<>();
for (Transaction tx : transactions) {
result.add(RecordSerializer.makeRecord(table, "tablespace", tableSpaceManager.getTableSpaceName(), "txid", tx.transactionId, "creationtimestamp", new java.sql.Timestamp(tx.localCreationTimestamp)));
}
return result;
}
Aggregations