mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-10-08 19:45:49 +08:00
Fixed PSQL dependency
This commit is contained in:
parent
fafb1f3ff0
commit
49daa14fef
3 changed files with 9 additions and 4 deletions
|
@ -45,3 +45,10 @@ impl From<tokio_postgres::Error> for crate::Error {
|
|||
Self::InternalError(format!("PostgreSQL error: {}", err))
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn deserialize_bitmap(bytes: &[u8]) -> crate::Result<roaring::RoaringBitmap> {
|
||||
roaring::RoaringBitmap::deserialize_unchecked_from(bytes).map_err(|err| {
|
||||
crate::Error::InternalError(format!("Failed to deserialize bitmap: {}", err))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -25,12 +25,11 @@ use futures::{pin_mut, TryStreamExt};
|
|||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::{
|
||||
backend::rocksdb::bitmap::deserialize_bitmap,
|
||||
write::{BitmapClass, ValueClass},
|
||||
BitmapKey, Deserialize, IterateParams, Key, ValueKey, WITHOUT_BLOCK_NUM,
|
||||
};
|
||||
|
||||
use super::PostgresStore;
|
||||
use super::{deserialize_bitmap, PostgresStore};
|
||||
|
||||
impl PostgresStore {
|
||||
pub(crate) async fn get_value<U>(&self, key: impl Key) -> crate::Result<Option<U>>
|
||||
|
|
|
@ -33,12 +33,11 @@ use roaring::RoaringBitmap;
|
|||
use tokio_postgres::{error::SqlState, IsolationLevel};
|
||||
|
||||
use crate::{
|
||||
backend::rocksdb::bitmap::deserialize_bitmap,
|
||||
write::{Batch, Operation, ValueOp, MAX_COMMIT_ATTEMPTS, MAX_COMMIT_TIME},
|
||||
BitmapKey, IndexKey, Key, LogKey, ValueKey, SUBSPACE_COUNTERS, WITHOUT_BLOCK_NUM,
|
||||
};
|
||||
|
||||
use super::PostgresStore;
|
||||
use super::{deserialize_bitmap, PostgresStore};
|
||||
|
||||
impl PostgresStore {
|
||||
pub(crate) async fn write(&self, batch: Batch) -> crate::Result<()> {
|
||||
|
|
Loading…
Add table
Reference in a new issue