Skip to content

Commit

Permalink
[ISSUE #2209]🚸Implement DefaultMappedFile#get_mapped_byte_buffer🍻
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm committed Jan 11, 2025
1 parent 8bdcd30 commit 773475a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions rocketmq-store/src/log_file/mapped_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ pub trait MappedFile {
///
/// # Returns
/// A `bytes::Bytes` instance containing the byte buffer of the entire mapped file.
fn get_mapped_byte_buffer(&self) -> bytes::Bytes;
fn get_mapped_byte_buffer(&self) -> &[u8];

/// Creates a slice of the mapped byte buffer.
///
Expand Down Expand Up @@ -614,7 +614,6 @@ pub trait MappedFileRefactor {
cb: &dyn CompactionAppendMsgCallback,
) -> AppendMessageResult;

fn get_mapped_byte_buffer(&self) -> &[u8];
fn slice_byte_buffer(&self) -> &[u8];
fn get_store_timestamp(&self) -> u64;
fn get_last_modified_timestamp(&self) -> u64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,10 @@ impl MappedFile for DefaultMappedFile {
}

#[inline]
fn get_mapped_byte_buffer(&self) -> Bytes {
todo!()
fn get_mapped_byte_buffer(&self) -> &[u8] {
self.mapped_byte_buffer_access_count_since_last_swap
.fetch_add(1, Ordering::AcqRel);
self.mmapped_file.as_ref()

Check warning on line 530 in rocketmq-store/src/log_file/mapped_file/default_mapped_file_impl.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-store/src/log_file/mapped_file/default_mapped_file_impl.rs#L527-L530

Added lines #L527 - L530 were not covered by tests
}

#[inline]
Expand Down

0 comments on commit 773475a

Please # to comment.