mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Three of these were not branding at all — they were live breakage, because the server was renamed and its consumers were not: - dashboard.html parsed `ClickHouseAsyncMetrics_` while PrometheusMetricsWriter emits `DatastoreAsyncMetrics_`. Paste the Prometheus output into the metrics editor and it matched nothing. - trace-visualizer queried `attribute['clickhouse.thread_id']` while OpenTelemetryTraceContext records `datastore.thread_id`. The trace tab found no spans. - both visualizers loaded `js/query-clickhouse.js`; the file on disk is `query-datastore.js`, so the script 404'd and the query function never existed. The rest is the name: titles, navbar brands, the status line a user reads after connecting, links into upstream's repo and docs site, their Cloud badges, and tests-visualizer pulling a logo from their CDN and querying their public demo server. Local symbols and DOM ids went with them (queryDatastore, parseDatastoreTrace, #tabDatastore). LICENSE, NOTICE and every copyright notice are untouched — no removed line in this diff carries a ©, an SPDX id or an attribution. `clickhouse_lexer_*` in docs.html STAYS, and a comment at the embed site says why: those export names are baked into the base64 WebAssembly payload, so the JS must match the blob. Renaming means renaming the C API, rebuilding Lexer.wasm, re-embedding it and updating the calls in one change; rename either side alone and syntax highlighting fails silently. Co-authored-by: Hanzo Dev <[email protected]>
28 lines
855 B
JavaScript
28 lines
855 B
JavaScript
import { queryDatastore } from './queryDatastore.js';
|
|
|
|
export async function* datastorePartsInserter({host, user, password, query, table, database, partition})
|
|
{
|
|
if (!query)
|
|
{
|
|
let where = "WHERE active = 1";
|
|
if (table)
|
|
where += ` AND table = ${table}`;
|
|
if (database)
|
|
where += ` AND database = ${database}`;
|
|
if (partition)
|
|
where += ` AND partition = ${partition}`;
|
|
query = `SELECT * FROM system.parts ${where} ORDER BY min_block_number`;
|
|
}
|
|
let rows = [];
|
|
await queryDatastore({
|
|
host,
|
|
user,
|
|
password,
|
|
query,
|
|
for_each_row: (data) => rows.push(data)
|
|
});
|
|
yield {type: 'sleep', delay: 0};
|
|
for (const row of rows)
|
|
yield {type: 'insert', bytes: +row.bytes_on_disk}; // TODO(serxa): pass modification_time
|
|
}
|