mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 15:26:17 +00:00
fix(modules): meter host calls, cap tables, storage quotas, separate key wrapping from sealing, no lock-order deadlock, unique macro names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0faff9ae96
commit
fcdfeb216a
6 files changed
+417
-18
No files matched your search
@@ -66,6 +66,16 @@ impl Graph {
|
||||
Ok(rows)
|
||||
}
|
||||
|
||||
/// Number of live entries of `module` and their total size (keys plus values, bytes).
|
||||
pub fn module_data_usage(&self, module: &str) -> Result<(u64, u64)> {
|
||||
Ok(self.row(
|
||||
"SELECT count(*), coalesce(sum(length(CAST(key AS BLOB)) + length(CAST(value AS BLOB))), 0)
|
||||
FROM module_data WHERE module=?1 AND value IS NOT NULL",
|
||||
params![module],
|
||||
|r| Ok((r.get::<_, i64>(0)? as u64, r.get::<_, i64>(1)? as u64)),
|
||||
)?)
|
||||
}
|
||||
|
||||
/// Sets (`Some`) or deletes (`None`) an entry, logged as [`Op::PutModuleData`]. Deleting an
|
||||
/// unset key is a no-op.
|
||||
pub fn set_module_data(&self, module: &str, key: &str, value: Option<&str>) -> Result<()> {
|
||||
|
||||
Reference in new issue
Block a user