Search in sources :

Example 1 with TableEntry

use of io.dingodb.server.protocol.proto.TableEntry in project dingo by dingodb.

the class MetaServiceClient method onTableMessage.

private void onTableMessage(Message message, Channel channel) {
    try {
        TableEntry tableEntry = readTableEntry(ByteBuffer.wrap(message.toBytes()));
        tableEntries.put(tableEntry.tableName(), tableEntry);
    } catch (IOException e) {
        return;
    }
}
Also used : TableEntry(io.dingodb.server.protocol.proto.TableEntry) IOException(java.io.IOException)

Example 2 with TableEntry

use of io.dingodb.server.protocol.proto.TableEntry in project dingo by dingodb.

the class MetaServiceClient method getTableEntry.

private TableEntry getTableEntry(String name) {
    TableEntry tableEntry = RemoteServerCaller.call(connector::newChannel, GET_TABLE.message(META_SERVICE, encodeString(name)), this::readTableEntry);
    tableEntries.put(tableEntry.tableName(), tableEntry);
    return tableEntry;
}
Also used : TableEntry(io.dingodb.server.protocol.proto.TableEntry)

Example 3 with TableEntry

use of io.dingodb.server.protocol.proto.TableEntry in project dingo by dingodb.

the class MetaServiceClient method getAll.

private Map<String, TableDefinition> getAll() {
    return RemoteServerCaller.call(connector::newChannel, GET_ALL.message(META_SERVICE), buffer -> {
        int size = PrimitiveCodec.readZigZagInt(buffer);
        Map<String, TableDefinition> result = new HashMap<>(size);
        for (int i = 0; i < size; i++) {
            TableEntry entry = readTableEntry(buffer);
            tableEntries.put(entry.tableName(), entry);
            result.put(entry.tableName(), entry.tableDefinition());
        }
        return result;
    });
}
Also used : TableEntry(io.dingodb.server.protocol.proto.TableEntry) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TableDefinition(io.dingodb.common.table.TableDefinition) PrimitiveCodec.encodeString(io.dingodb.common.codec.PrimitiveCodec.encodeString)

Aggregations

TableEntry (io.dingodb.server.protocol.proto.TableEntry)3 PrimitiveCodec.encodeString (io.dingodb.common.codec.PrimitiveCodec.encodeString)1 TableDefinition (io.dingodb.common.table.TableDefinition)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1