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

[TieredStorage] Use mmap.len() in TieredStorage::file_size() for HotStorage #381

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

yhchiang-sol
Copy link

Problem

The current implementation of TieredStorage::file_size() requires
a sys-call to provide the file size.

Summary of Changes

Add len() API to TieredStorageReader, and have HotStorageReader()
implement the API using Mmap::len().

Test Plan

Update existing unit-test to also verify HotStorageReader::len().

@yhchiang-sol yhchiang-sol marked this pull request as draft March 22, 2024 01:05
@yhchiang-sol yhchiang-sol force-pushed the ts-cache-file-size branch 3 times, most recently from 30ff8bf to 86be04e Compare March 22, 2024 08:48
@yhchiang-sol yhchiang-sol marked this pull request as ready for review March 22, 2024 08:49
.and_then(|file| file.metadata())
.map(|metadata| metadata.len())
.unwrap_or(0))
Ok(self.reader().map_or(0, |reader| reader.len()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR directly, but why does this method return a Result? Seems like returning a u64 should be fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I also noticed that. Will have a PR that have it return u64 and rename it to len() for consistency.

@yhchiang-sol yhchiang-sol merged commit f1a82cb into anza-xyz:master Mar 22, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants