-
Did Allocations (approx)
-
- {#if stats.loading}
-
Loading...
- {:else if stats.current}
-
- {:else if stats.error}
-
{stats.error}
- {/if}
-
-
-
diff --git a/src/routes/plc/CountsGraph.svelte b/src/routes/plc/Uses.svelte
similarity index 50%
rename from src/routes/plc/CountsGraph.svelte
rename to src/routes/plc/Uses.svelte
index 218abba..8c16f1d 100644
--- a/src/routes/plc/CountsGraph.svelte
+++ b/src/routes/plc/Uses.svelte
@@ -1,32 +1,30 @@
-
Operations & Dids over time
+
PLC Uses (approx)
{#if stats.loading}
Loading...
{:else if stats.current}
-
{:else if stats.error}
{stats.error}
@@ -37,13 +35,16 @@
.chart {
background-color: var(--background-secondary);
border-radius: 12px;
- margin: 12px 0px;
padding: 8px 12px;
- overflow: hidden;
h4 {
margin-top: 4px;
margin-bottom: 16px;
}
+
+ small {
+ font-size: 0.9rem;
+ color: var(--text-grey);
+ }
}
diff --git a/src/routes/plc/plc.remote.ts b/src/routes/plc/plc.remote.ts
index facd896..ca156fe 100644
--- a/src/routes/plc/plc.remote.ts
+++ b/src/routes/plc/plc.remote.ts
@@ -6,10 +6,10 @@ interface HistoryEntry {
operations: number;
}
-interface PdsShare {
+interface PlcUses {
deactivated: number;
- withPds: number;
- withoutPds: number;
+ pds: number;
+ other: number;
}
interface RawStats {
@@ -18,7 +18,7 @@ interface RawStats {
operations: number;
history: Record
;
pdsDistribution: Record;
- pdsShare: PdsShare;
+ uses: PlcUses;
}
interface HistoryGraphPoint {
@@ -41,7 +41,7 @@ async function fetchRawStats() {
interface Stats {
pdsDistribution: { key: string; value: number }[];
history: HistoryGraphPoint[];
- pdsShare: PdsShare;
+ uses: PlcUses;
}
export const getStats = query(async () => {
@@ -61,7 +61,7 @@ export const getStats = query(async () => {
}
return {
- pdsShare: raw.pdsShare,
+ uses: raw.uses,
pdsDistribution: distribution
.entries()
.map((d) => ({ key: d[0], value: d[1] }))
diff --git a/uplc/src/stats.rs b/uplc/src/stats.rs
index 33ece6f..9585627 100644
--- a/uplc/src/stats.rs
+++ b/uplc/src/stats.rs
@@ -12,10 +12,10 @@ pub struct CountsHistoryPoint {
#[derive(Debug, Default, Serialize)]
#[serde(rename_all = "camelCase")]
-pub struct PdsShare {
+pub struct Uses {
pub deactivated: i64,
- pub with_pds: i64,
- pub without_pds: i64,
+ pub pds: i64,
+ pub other: i64,
}
#[derive(Debug, Default, Serialize)]
@@ -25,7 +25,7 @@ pub struct Stats {
pub dids: i64,
pub last_operation: String,
pub history: HashMap,
- pub pds_share: PdsShare,
+ pub uses: Uses,
pub pds_distribution: HashMap,
}
@@ -62,7 +62,7 @@ impl Stats {
})?
.collect::, _>>()?;
- // Merge the scalar counts, PDS share, and PDS distribution into one query.
+ // Merge the scalar counts, PDS Uses, and PDS distribution into one query.
// `latest_ops` is computed once; `count(*)` on it replaces `count(DISTINCT did)`.
let mut stmt = conn.prepare(
r#"
@@ -118,24 +118,22 @@ impl Stats {
row.get::<_, String>(1)?, // last_op
row.get::<_, i64>(2)?, // dids
row.get::<_, i64>(3)?, // deactivated
- row.get::<_, i64>(4)?, // with_pds
- row.get::<_, i64>(5)?, // without_pds
+ row.get::<_, i64>(4)?, // pds
+ row.get::<_, i64>(5)?, // other
row.get::<_, Option>(6)?, // service
row.get::<_, Option>(7)?, // count
))
})?
.collect::, _>>()?;
- if let Some((total_ops, last_op, dids, deactivated, with_pds, without_pds, _, _)) =
- rows.first()
- {
+ if let Some((total_ops, last_op, dids, deactivated, pds, other, _, _)) = rows.first() {
self.operations = *total_ops;
self.last_operation = last_op.clone();
self.dids = *dids;
- self.pds_share = PdsShare {
+ self.uses = Uses {
deactivated: *deactivated,
- with_pds: *with_pds,
- without_pds: *without_pds,
+ pds: *pds,
+ other: *other,
};
}
@@ -158,11 +156,11 @@ impl Stats {
}
if op.tombstone {
- self.pds_share.deactivated += 1;
+ self.uses.deactivated += 1;
}
if let Some(service) = &op.service {
- self.pds_share.with_pds += 1;
+ self.uses.pds += 1;
if let Some(count) = self.pds_distribution.get_mut(service) {
*count += 1;
@@ -170,7 +168,7 @@ impl Stats {
self.pds_distribution.insert(service.clone(), 1);
}
} else {
- self.pds_share.without_pds += 1;
+ self.uses.other += 1;
}
let entry = self.history.entry(week_key(&op.created_at)?).or_default();