Skip to content

Commit

Permalink
refactor: change obj cache method names and use more readable default…
Browse files Browse the repository at this point in the history
… usize value
  • Loading branch information
sdd committed Aug 9, 2024
1 parent 0c1c40c commit 2a4f0d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/iceberg/src/io/object_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::spec::{
};
use crate::{Error, ErrorKind, Result};

const DEFAULT_CACHE_SIZE_BYTES: u64 = 2 ^ 15; // 32MB
const DEFAULT_CACHE_SIZE_BYTES: u64 = 32 * 1024 * 1024; // 32MB

#[derive(Clone, Debug)]
pub(crate) enum CachedItem {
Expand All @@ -49,12 +49,12 @@ impl ObjectCache {
/// Creates a new [`ObjectCache`]
/// with the default cache size
pub(crate) fn new(file_io: FileIO) -> Self {
Self::new_with_cache_size(file_io, DEFAULT_CACHE_SIZE_BYTES)
Self::new_with_capacity(file_io, DEFAULT_CACHE_SIZE_BYTES)
}

/// Creates a new [`ObjectCache`]
/// with a specific cache size
pub(crate) fn new_with_cache_size(file_io: FileIO, cache_size_bytes: u64) -> Self {
pub(crate) fn new_with_capacity(file_io: FileIO, cache_size_bytes: u64) -> Self {
if cache_size_bytes == 0 {
Self::with_disabled_cache(file_io)
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl TableBuilder {
let object_cache = if disable_cache {
Arc::new(ObjectCache::with_disabled_cache(file_io.clone()))
} else if let Some(cache_size_bytes) = cache_size_bytes {
Arc::new(ObjectCache::new_with_cache_size(
Arc::new(ObjectCache::new_with_capacity(
file_io.clone(),
cache_size_bytes,
))
Expand Down

0 comments on commit 2a4f0d1

Please sign in to comment.