2022-08-07 19:42:22 +02:00
|
|
|
mod data;
|
2022-10-08 13:04:55 +02:00
|
|
|
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) use data::Data;
|
2022-10-05 20:34:31 +02:00
|
|
|
use ruma::{DeviceId, TransactionId, UserId};
|
2021-06-08 18:10:00 +02:00
|
|
|
|
2022-09-07 13:25:51 +02:00
|
|
|
use crate::Result;
|
2020-08-25 13:24:38 +02:00
|
|
|
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) struct Service {
|
|
|
|
|
pub(crate) db: &'static dyn Data,
|
2020-08-25 13:24:38 +02:00
|
|
|
}
|
|
|
|
|
|
2022-10-05 12:45:54 +02:00
|
|
|
impl Service {
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) fn add_txnid(
|
2020-12-08 10:33:44 +01:00
|
|
|
&self, user_id: &UserId, device_id: Option<&DeviceId>, txn_id: &TransactionId, data: &[u8],
|
2020-08-25 13:24:38 +02:00
|
|
|
) -> Result<()> {
|
2022-10-05 20:33:55 +02:00
|
|
|
self.db.add_txnid(user_id, device_id, txn_id, data)
|
2020-08-25 13:24:38 +02:00
|
|
|
}
|
|
|
|
|
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) fn existing_txnid(
|
2020-12-08 10:33:44 +01:00
|
|
|
&self, user_id: &UserId, device_id: Option<&DeviceId>, txn_id: &TransactionId,
|
2021-06-08 18:10:00 +02:00
|
|
|
) -> Result<Option<Vec<u8>>> {
|
2022-10-05 20:33:55 +02:00
|
|
|
self.db.existing_txnid(user_id, device_id, txn_id)
|
2020-08-25 13:24:38 +02:00
|
|
|
}
|
|
|
|
|
}
|