Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/api/router/snapshot_content_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ async fn mst2_publication_disabled_resolve_preserves_head_body_object_map_page_a
assert_eq!(chunk.file_content_id, fixture.digest);
assert_eq!(chunk.chunk_index, 0);
assert_eq!(end.request_item_count, 1);
assert_eq!(end.logical_bytes, CHUNK_SIZE);
assert_eq!(end.logical_bytes, u64::from(CHUNK_SIZE));
}

#[tokio::test]
Expand Down
12 changes: 8 additions & 4 deletions src/api/router/snapshot_rooted_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
jupiter::storage::qualified_metadata_family::RootedLookupStatus,
};

fn entry_json(entry: &Entry) -> Result<serde_json::Value, Response> {
fn entry_json(entry: &Entry) -> Result<serde_json::Value, SnapshotError> {
let name = std::str::from_utf8(&entry.name).map_err(internal)?;
let kind = match entry.kind {
EntryKind::Regular => "regular",
Expand All @@ -28,15 +28,19 @@ fn entry_json(entry: &Entry) -> Result<serde_json::Value, Response> {
Ok(value)
}

fn cursor_name(sid: &str, path: &str, query: &DirectoryQuery) -> Result<Option<String>, Response> {
fn cursor_name(
sid: &str,
path: &str,
query: &DirectoryQuery,
) -> Result<Option<String>, SnapshotError> {
let Some(cursor) = query.cursor.as_deref() else {
return Ok(None);
};
let invalid = || {
mst2_error_response(SnapshotError::new(
SnapshotError::new(
SnapshotErrorCode::CursorInvalid,
"cursor bound to different parameters or invalid",
))
)
};
let (payload, signature) = cursor.rsplit_once('.').ok_or_else(invalid)?;
if runtime().sign_cursor(payload) != signature {
Expand Down
4 changes: 1 addition & 3 deletions src/jupiter/storage/qualified_metadata_family.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ const GC_SQL: &str = include_str!("qualified_metadata_gc.sql");

#[path = "qualified_metadata_rooted.rs"]
mod rooted;
pub(crate) use rooted::{
RootedDirectoryWindow, RootedLookupBatch, RootedLookupStatus, RootedQualifiedMetadataRepository,
};
pub(crate) use rooted::{RootedLookupStatus, RootedQualifiedMetadataRepository};
#[cfg(test)]
pub(crate) use rooted::{
RootedPrepareIntent, with_rooted_reader_barriers, with_rooted_source_fact_barriers,
Expand Down
6 changes: 4 additions & 2 deletions src/jupiter/storage/qualified_metadata_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use crate::{
},
};

type ProofPages = Vec<([u8; 32], Vec<u8>)>;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct Binding {
generation: i64,
Expand Down Expand Up @@ -98,7 +100,7 @@ pub(crate) struct RootedDirectoryWindow {
pub entry_count: u64,
pub entries: Vec<mst2_codec::metapage::Entry>,
pub has_more: bool,
pub proof_pages: Vec<([u8; 32], Vec<u8>)>,
pub proof_pages: ProofPages,
pub ancestors: Vec<(String, [u8; 32])>,
}

Expand Down Expand Up @@ -541,7 +543,7 @@ impl Reader<'_> {
Ok(children)
}

fn proofs(&self) -> Result<Vec<([u8; 32], Vec<u8>)>, SnapshotError> {
fn proofs(&self) -> Result<ProofPages, SnapshotError> {
let bytes: usize = self.cache.values().map(|page| page.bytes.len()).sum();
if bytes > 1_048_576 {
return Err(SnapshotError::new(
Expand Down
Loading