store: build the legacy unloadable rows' path only with sqlite-store

This commit is contained in:
DeFiDude committed 2026-11-15 08:49:47 -07:00
1 parent 0680941fe4
commit 81e6188e4c
2 files changed
+5 -1

No files matched your search

+3 -1
View File
@@ -27,8 +27,9 @@ pub struct LegacyImport {
}
/// A legacy known-destination row as upstream imports it (Storage.py
/// `import_legacy`), whatever the length of its public key.
/// `import_legacy`), whatever the length of its public key. Only a SQLite store keeps it.
#[derive(Debug)]
#[cfg_attr(not(feature = "sqlite-store"), allow(dead_code))]
pub(crate) struct RawKnownRow {
pub(crate) destination_hash: DestHash,
pub(crate) last_heard: f64,
@@ -43,6 +44,7 @@ pub(crate) struct RawKnownRow {
impl LegacyImport {
/// Rows whose public key is not 64 bytes: the database keeps them, the table cannot load them.
#[cfg_attr(not(feature = "sqlite-store"), allow(dead_code))]
pub(crate) fn unloadable(&self) -> &[RawKnownRow] {
&self.unloadable
}
+2
View File
@@ -269,10 +269,12 @@ pub trait KnownDestinationStore: Send {
}
/// A store that keeps the legacy rows its table cannot load, as upstream's import does.
#[cfg(feature = "sqlite-store")]
pub(crate) trait KeepUnloadable: KnownDestinationStore {
fn keep_unloadable(&mut self, rows: &[legacy::RawKnownRow]) -> Result<(), StoreError>;
}
#[cfg(feature = "sqlite-store")]
impl KeepUnloadable for MemoryStore {
/// Only a database holds them.
fn keep_unloadable(&mut self, _rows: &[legacy::RawKnownRow]) -> Result<(), StoreError> {