Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Aug 18, 2025

Related: #1417
Resolves: #1418

@patrick-ogrady patrick-ogrady requested a review from Copilot August 18, 2025 20:25
pub struct Any<
E: Storage + Clock + Metrics,
K: Array,
V: CodecFixed<Cfg = ()>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the future, we can debate whether we want to allow Cfg to be passed here (this just minimizes the diff).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new trait CodecFixed that combines Codec and EncodeFixed traits, providing a convenient interface for types that can be both encoded and decoded from fixed-size byte sequences. The change replaces the generic Array constraint with CodecFixed across the storage layer to enable more flexible value types while maintaining fixed-size encoding capabilities.

Key changes include:

  • Addition of the CodecFixed trait in the codec module
  • Replacement of Array type constraints with CodecFixed for value types throughout storage operations
  • Updates to Display implementations to use hex encoding for value representation
  • Enhanced error handling in ordinal storage record validation

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
codec/src/codec.rs Introduces the new CodecFixed trait combining Codec and EncodeFixed
storage/src/store/operation.rs Replaces Array with CodecFixed for value types and updates display formatting
storage/src/ordinal/storage.rs Updates value type constraints and improves record validation error handling
storage/src/journal/fixed.rs Changes type constraints from Codec + FixedSize to CodecFixed
storage/src/adb/verify.rs Adds utility functions for proof construction and digest calculation
storage/src/adb/sync/resolver.rs Updates type constraints to use CodecFixed with additional trait bounds
storage/src/adb/immutable/mod.rs Simplifies snapshot operations by removing redundant helper function
storage/src/adb/current.rs Updates type constraints for current database implementation
storage/src/adb/any/fixed/sync.rs Updates journal initialization functions to use CodecFixed
storage/src/adb/any/fixed/mod.rs Updates the main Any struct type constraints

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

/// during this call.
pub async fn set(&mut self, key: K, value: V) -> Result<(), Error> {
let loc = self.log_size;
Immutable::<E, K, V, H, T>::set_loc(&mut self.snapshot, &key, loc).await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous approach didn't end up pruning any useless info.

@patrick-ogrady patrick-ogrady marked this pull request as ready for review August 18, 2025 20:30
@patrick-ogrady patrick-ogrady merged commit a7a4699 into main Aug 18, 2025
36 of 37 checks passed
@patrick-ogrady patrick-ogrady deleted the codec-fixed branch August 18, 2025 23:24
@codecov
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

❌ Patch coverage is 78.94737% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.70%. Comparing base (52c04a9) to head (6cc5ccc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
storage/src/adb/verify.rs 0.00% 10 Missing ⚠️
storage/src/ordinal/mod.rs 90.90% 4 Missing ⚠️
storage/src/store/operation.rs 75.00% 2 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1423      +/-   ##
==========================================
- Coverage   91.72%   91.70%   -0.02%     
==========================================
  Files         275      275              
  Lines       69392    69443      +51     
==========================================
+ Hits        63651    63685      +34     
- Misses       5741     5758      +17     
Files with missing lines Coverage Δ
codec/src/codec.rs 100.00% <ø> (ø)
storage/src/adb/any/fixed/mod.rs 98.54% <ø> (ø)
storage/src/adb/any/fixed/sync.rs 98.77% <100.00%> (ø)
storage/src/adb/current.rs 96.84% <ø> (ø)
storage/src/adb/immutable/mod.rs 96.96% <100.00%> (-0.04%) ⬇️
storage/src/adb/sync/resolver.rs 56.25% <ø> (ø)
storage/src/journal/fixed.rs 97.60% <ø> (ø)
storage/src/ordinal/storage.rs 92.27% <100.00%> (+0.03%) ⬆️
storage/src/store/operation.rs 88.57% <75.00%> (+0.10%) ⬆️
storage/src/ordinal/mod.rs 99.64% <90.90%> (-0.36%) ⬇️
... and 1 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52c04a9...6cc5ccc. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[storage] Revisit Requirement for Array in journal::Fixed

3 participants