Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Make Blockstore::get_data_shreds_for_slot() return type consistent #32460

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

steviez
Copy link
Contributor

@steviez steviez commented Jul 11, 2023

Problem

We have several other functions that return data shreds; however, these other functions map shred::Error to BlockstoreError. The other functions being:

pub fn get_data_shred(&self, slot: Slot, index: u64) -> Result<Option<Vec<u8>>> {

and
pub fn get_entries_in_data_block(
&self,
slot: Slot,
start_index: u32,
end_index: u32,
slot_meta: Option<&SlotMeta>,
) -> Result<Vec<Entry>> {

The second one actually returns a Vec<Entry>, but the point stands that the return type of the function is Result<T, BlockstoreError>.

Summary of Changes

Make this function consistent with those and map the error.

Broke this out as cleanup from another PR

@steviez steviez marked this pull request as ready for review July 11, 2023 20:55
@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Merging #32460 (2345f56) into master (0a1e641) will increase coverage by 0.0%.
The diff coverage is 57.1%.

@@           Coverage Diff           @@
##           master   #32460   +/-   ##
=======================================
  Coverage    82.1%    82.1%           
=======================================
  Files         778      778           
  Lines      210093   210098    +5     
=======================================
+ Hits       172545   172603   +58     
+ Misses      37548    37495   -53     

@steviez steviez requested review from yhchiang-sol and jbiseda July 11, 2023 21:05
Copy link
Contributor

@jbiseda jbiseda left a comment

Choose a reason for hiding this comment

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

Looks good, one cleanup comment.

ledger/src/blockstore.rs Outdated Show resolved Hide resolved
We have several other functions that return data shreds; however, these
other functions map shred::Error to BlockstoreError. Make this function
consistent with those and map the error.
@steviez steviez force-pushed the bstore_get_shred_api branch from 2a8380a to 2345f56 Compare July 11, 2023 22:51
Copy link
Contributor

@jbiseda jbiseda left a comment

Choose a reason for hiding this comment

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

LGTM!

@steviez steviez merged commit 04fab2b into solana-labs:master Jul 12, 2023
@steviez steviez deleted the bstore_get_shred_api branch July 12, 2023 02:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants