Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename as_bytes to as_byte in ReadableSize (#428) #765

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions analytic_engine/src/compaction/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ impl LevelPicker for SizeTieredPicker {
segment.to_vec(),
opts.bucket_high,
opts.bucket_low,
opts.min_sstable_size.as_bytes() as f32,
opts.min_sstable_size.as_byte() as f32,
);

let files = Self::most_interesting_bucket(
buckets,
opts.min_threshold,
opts.max_threshold,
opts.max_input_sstable_size.as_bytes(),
opts.max_input_sstable_size.as_byte(),
);

if files.is_some() {
Expand Down Expand Up @@ -497,13 +497,13 @@ impl TimeWindowPicker {
bucket.to_vec(),
size_tiered_opts.bucket_high,
size_tiered_opts.bucket_low,
size_tiered_opts.min_sstable_size.as_bytes() as f32,
size_tiered_opts.min_sstable_size.as_byte() as f32,
);
let files = SizeTieredPicker::most_interesting_bucket(
buckets,
size_tiered_opts.min_threshold,
size_tiered_opts.max_threshold,
size_tiered_opts.max_input_sstable_size.as_bytes(),
size_tiered_opts.max_input_sstable_size.as_byte(),
);

if files.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion analytic_engine/src/compaction/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl SchedulerImpl {
request_buf: RwLock::new(RequestQueue::default()),
}),
running: running.clone(),
memory_limit: MemoryLimit::new(config.memory_limit.as_bytes() as usize),
memory_limit: MemoryLimit::new(config.memory_limit.as_byte() as usize),
};

let handle = runtime.spawn(async move {
Expand Down
6 changes: 3 additions & 3 deletions analytic_engine/src/instance/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Instance {
space_store.clone(),
bg_runtime.clone(),
scheduler_config,
ctx.config.write_sst_max_buffer_size.as_bytes() as usize,
ctx.config.write_sst_max_buffer_size.as_byte() as usize,
scan_options_for_compaction,
));

Expand Down Expand Up @@ -104,11 +104,11 @@ impl Instance {
db_write_buffer_size: ctx.config.db_write_buffer_size,
space_write_buffer_size: ctx.config.space_write_buffer_size,
replay_batch_size: ctx.config.replay_batch_size,
write_sst_max_buffer_size: ctx.config.write_sst_max_buffer_size.as_bytes() as usize,
write_sst_max_buffer_size: ctx.config.write_sst_max_buffer_size.as_byte() as usize,
max_bytes_per_write_batch: ctx
.config
.max_bytes_per_write_batch
.map(|v| v.as_bytes() as usize),
.map(|v| v.as_byte() as usize),
iter_options,
scan_options,
remote_engine: remote_engine_ref,
Expand Down
10 changes: 5 additions & 5 deletions analytic_engine/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ fn open_storage(
}
};

if opts.disk_cache_capacity.as_bytes() > 0 {
if opts.disk_cache_capacity.as_byte() > 0 {
let path = Path::new(&opts.disk_cache_dir).join(DISK_CACHE_DIR_NAME);
tokio::fs::create_dir_all(&path).await.context(CreateDir {
path: path.to_string_lossy().into_owned(),
Expand All @@ -471,20 +471,20 @@ fn open_storage(
store = Arc::new(
DiskCacheStore::try_new(
path.to_string_lossy().into_owned(),
opts.disk_cache_capacity.as_bytes() as usize,
opts.disk_cache_page_size.as_bytes() as usize,
opts.disk_cache_capacity.as_byte() as usize,
opts.disk_cache_page_size.as_byte() as usize,
store,
)
.await
.context(OpenObjectStore)?,
) as _;
}

if opts.mem_cache_capacity.as_bytes() > 0 {
if opts.mem_cache_capacity.as_byte() > 0 {
let mem_cache = Arc::new(
MemCache::try_new(
opts.mem_cache_partition_bits,
NonZeroUsize::new(opts.mem_cache_capacity.as_bytes() as usize).unwrap(),
NonZeroUsize::new(opts.mem_cache_capacity.as_byte() as usize).unwrap(),
)
.context(OpenMemCache)?,
);
Expand Down
2 changes: 1 addition & 1 deletion common_util/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl ReadableSize {
self.0 / MIB
}

pub const fn as_bytes(self) -> u64 {
pub const fn as_byte(self) -> u64 {
self.0
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl<Q: QueryExecutor + 'static> Builder<Q> {
)
.local_endpoint(Endpoint::new(self.node_addr, self.server_config.grpc_port).to_string())
.resp_compress_min_length(
self.server_config.resp_compress_min_length.as_bytes() as usize
self.server_config.resp_compress_min_length.as_byte() as usize
)
.runtimes(engine_runtimes)
.instance(instance.clone())
Expand Down