Skip to content

Commit 8499196

Browse files
committed
Fix max db size inconsistency.
Change-Id: Id07007f28db88920d4881fe4f98ccba1ff956d98
1 parent cca400e commit 8499196

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

oak_private_memory/app/db_client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ use std::net::SocketAddr;
1818
use anyhow::bail;
1919
use log::info;
2020
use metrics::get_global_metrics;
21+
pub use oak_private_memory_database::database_with_cache::MAX_DECODE_SIZE;
2122
use sealed_memory_grpc_proto::oak::private_memory::sealed_memory_database_service_client::SealedMemoryDatabaseServiceClient;
2223
use tokio::sync::RwLock;
2324
use tonic::transport::{Channel, Endpoint};
25+
2426
const MAX_CONNECT_RETRIES: usize = 5;
2527
const INITIAL_BACKOFF_MS: u64 = 100;
26-
pub const MAX_DECODE_SIZE: usize = 100 * 1024 * 1024; // 100 MB
2728

2829
pub struct SharedDbClient {
2930
database_service_host: SocketAddr,

oak_private_memory/database/database_with_cache.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ use crate::{
2626
memory_cache::MemoryCache,
2727
};
2828

29-
const DATABASE_MAX_SIZE: usize = 1024 * 1024 * 1024; // 1 GB
30-
29+
// We limit the decode size to 100 MB and use this limit as the max size of the
30+
// database.
31+
pub const MAX_DECODE_SIZE: usize = 100 * 1024 * 1024; // 100 MB
3132
/// A database with cache. It loads the meta database of the user at start,
3233
/// then loads documents at request. The loaded documents will be then cached
3334
/// in memory.
@@ -52,7 +53,7 @@ impl DatabaseWithCache {
5253
cache: MemoryCache::new(db_client, dek),
5354
key_derivation_info,
5455
current_size: initial_size,
55-
max_size: DATABASE_MAX_SIZE,
56+
max_size: MAX_DECODE_SIZE,
5657
}
5758
}
5859

0 commit comments

Comments
 (0)