Now saving torrent updates properly to the new db

This commit is contained in:
Igor Katson 2024-08-15 11:20:20 +01:00
parent f29dccf8bd
commit d77d96bd48
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 92 additions and 37 deletions

View file

@ -59,12 +59,18 @@ impl SerializedTorrent {
}
}
// TODO: make this info_hash first, ID-second.
#[async_trait]
pub trait SessionPersistenceStore: core::fmt::Debug + Send + Sync {
async fn next_id(&self) -> anyhow::Result<TorrentId>;
async fn store(&self, id: TorrentId, torrent: &ManagedTorrentHandle) -> anyhow::Result<()>;
async fn delete(&self, id: TorrentId) -> anyhow::Result<()>;
async fn get(&self, id: TorrentId) -> anyhow::Result<SerializedTorrent>;
async fn update_metadata(
&self,
id: TorrentId,
torrent: &ManagedTorrentHandle,
) -> anyhow::Result<()>;
async fn stream_all(
&self,
) -> anyhow::Result<BoxStream<'_, anyhow::Result<(TorrentId, SerializedTorrent)>>>;