(txn: &redb::ReadTransaction, key: &str)
| 62 | } |
| 63 | |
| 64 | fn build_version(txn: &redb::ReadTransaction, key: &str) -> Observation<String> { |
| 65 | match read_version(txn, key) { |
| 66 | Ok(Some(value)) |
| 67 | if !value.is_empty() |
| 68 | && value.len() <= 128 |
| 69 | && value |
| 70 | .bytes() |
| 71 | .all(|b| b.is_ascii_alphanumeric() || b" .()-_+".contains(&b)) => |
| 72 | { |
| 73 | Observation::available(value) |
| 74 | } |
| 75 | Ok(None) => Observation::unavailable("not recorded"), |
| 76 | _ => Observation::unavailable("build metadata unreadable or invalid"), |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | #[derive(Debug, Default, Serialize)] |
| 81 | pub(crate) struct IntentCounts { |
no test coverage detected