Repository navigation
Extract explicit EC storage selection and celld #1537
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
Open
ChristianPavilonis
wants to merge
21
commits into
baseline/sourcepoint-20261110
from
baseline/ec-storage-20261110
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3776371
Extract explicit EC storage selection and celld persistence
ChristianPavilonis 9af2540
Carry the lower baseline check corrections into storage
ChristianPavilonis cdad6df
Carry the documentation site correction into storage
ChristianPavilonis 83f58c5
Carry the startup probe correction through the compatible baseline
ChristianPavilonis f14eefa
Carry the browser CI host compatibility fix through the baseline
ChristianPavilonis c279229
Carry the tagged EdgeZero snapshot through the stack
ChristianPavilonis 2610d4a
Carry the monthly EdgeZero tag through the stack
ChristianPavilonis bad5db5
Retain explicit EC storage and typed celld records on the cutover
ChristianPavilonis 3a0d8bf
Retain the owning partial-Geo parity fixture ancestry
ChristianPavilonis 4287413
Retain the concurrent cutover documentation closeout
ChristianPavilonis c9a8b66
Retain prepared native development documentation
ChristianPavilonis ad00c40
Select runtime-appropriate storage in local acceptance fixtures
ChristianPavilonis 5ab4ba8
Retain current main validation and mediator fallback
ChristianPavilonis 0df6080
Retain the Cargo target-aware cache harness
ChristianPavilonis 83b5bd0
Exercise the runtime-specific smoke helper in CLI store tests
ChristianPavilonis 53bcc15
Retain target-aware GPT bundle lookup for the cache fixture
ChristianPavilonis c04da1d
Carry hosted qualification fixes through PR 1537
ChristianPavilonis df61007
Carry hosted qualification fixes through PR 1537
ChristianPavilonis cca7318
Carry hosted qualification fixes through PR 1537
ChristianPavilonis b570c46
Carry hosted qualification fixes through PR 1537
ChristianPavilonis 4a83827
Carry hosted qualification fixes through PR 1537
ChristianPavilonis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| //! Native EC persistence through celld's typed conditional-record client. | ||
|
|
||
| use async_trait::async_trait; | ||
| use edgezero_core::EdgeError; | ||
| use edgezero_core::time::MonotonicClock; | ||
| use edgezero_store_celld::CelldPreparation; | ||
| use edgezero_store_celld::records::{ | ||
| CelldRecordStore, RecordWrite, RecordWriteMode, RecordWriteOutcome, | ||
| }; | ||
| use edgezero_store_celld::settings::{CelldAccessToken, CelldKvSettings, CelldPreparationLimits}; | ||
| use error_stack::Report; | ||
| use trusted_server_core::ec::kv_backend::{ | ||
| EcKvLookup, EcKvStore, EcKvWrite, EcKvWriteMode, EcKvWriteOutcome, | ||
| }; | ||
| use trusted_server_core::error::TrustedServerError; | ||
|
|
||
| /// A live provider. Clones share transport, never cached identity rows. | ||
| #[derive(Clone, Debug)] | ||
| pub struct CelldEcKv { | ||
| records: CelldRecordStore, | ||
| } | ||
|
|
||
| fn preparation_error() -> EdgeError { | ||
| EdgeError::internal(std::io::Error::other("native EC celld preparation failed")) | ||
| } | ||
|
|
||
| fn store_error() -> Report<TrustedServerError> { | ||
| Report::new(TrustedServerError::KvStore { | ||
| store_name: "native-ec-celld".to_owned(), | ||
| message: "EC celld operation failed".to_owned(), | ||
| }) | ||
| } | ||
|
|
||
| impl CelldEcKv { | ||
| /// Prepare an explicitly selected provider using one captured bootstrap token. | ||
| /// | ||
| /// # Errors | ||
| /// Invalid settings, credentials, protocol or service failures prevent readiness. | ||
| pub async fn prepare( | ||
| settings: &CelldKvSettings, | ||
| token: Option<&CelldAccessToken>, | ||
| ) -> Result<Self, EdgeError> { | ||
| let mut preparation = | ||
| CelldPreparation::new(MonotonicClock::default(), CelldPreparationLimits::default()) | ||
| .map_err(|_| preparation_error())?; | ||
| let records = preparation | ||
| .prepare_records(settings, token) | ||
| .await | ||
| .map_err(|_| preparation_error())?; | ||
| Ok(Self { records }) | ||
| } | ||
| } | ||
|
|
||
| #[async_trait(?Send)] | ||
| impl EcKvStore for CelldEcKv { | ||
| fn store_name(&self) -> &str { | ||
| "native-ec-celld" | ||
| } | ||
| async fn lookup(&self, key: &str) -> Result<Option<EcKvLookup>, Report<TrustedServerError>> { | ||
| self.records | ||
| .lookup(key) | ||
| .await | ||
| .map(|row| { | ||
| row.map(|row| EcKvLookup { | ||
| body: row.body, | ||
| metadata: row.metadata, | ||
| generation: row.generation, | ||
| }) | ||
| }) | ||
| .map_err(|_| store_error()) | ||
| } | ||
| async fn key_exists(&self, key: &str) -> Result<bool, Report<TrustedServerError>> { | ||
| self.records | ||
| .key_exists(key) | ||
| .await | ||
| .map_err(|_| store_error()) | ||
| } | ||
| async fn insert( | ||
| &self, | ||
| key: &str, | ||
| write: EcKvWrite<'_>, | ||
| ) -> Result<EcKvWriteOutcome, Report<TrustedServerError>> { | ||
| let mode = match write.mode { | ||
| EcKvWriteMode::Add => RecordWriteMode::Add, | ||
| EcKvWriteMode::Overwrite => RecordWriteMode::Overwrite, | ||
| EcKvWriteMode::IfGenerationMatch(generation) => { | ||
| RecordWriteMode::IfGenerationMatch(generation) | ||
| } | ||
| }; | ||
| self.records | ||
| .insert( | ||
| key, | ||
| RecordWrite { | ||
| body: write.body.as_bytes(), | ||
| metadata: Some(write.metadata.as_bytes()), | ||
| ttl: write.ttl, | ||
| mode, | ||
| }, | ||
| ) | ||
| .await | ||
| .map(|outcome| match outcome { | ||
| RecordWriteOutcome::Written => EcKvWriteOutcome::Written, | ||
| RecordWriteOutcome::PreconditionFailed => EcKvWriteOutcome::PreconditionFailed, | ||
| }) | ||
| .map_err(|_| store_error()) | ||
| } | ||
| async fn list_keys_with_prefix( | ||
| &self, | ||
| prefix: &str, | ||
| limit: u32, | ||
| ) -> Result<Vec<String>, Report<TrustedServerError>> { | ||
| self.records | ||
| .list_keys_with_prefix(prefix, limit) | ||
| .await | ||
| .map_err(|_| store_error()) | ||
| } | ||
| async fn delete(&self, key: &str) -> Result<(), Report<TrustedServerError>> { | ||
| self.records.delete(key).await.map_err(|_| store_error()) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 thinking: Every preparation failure (bad or rejected token, unsupported protocol or record version, unreachable service) collapses into the same
native EC celld preparation failed, andstore_errordoes the same for request-time errors. Hiding input values is intended, but an operator can't tell a credential problem from an outage. Could you attach a value-free error category from the celld error kind (for examplecredential,protocolortransport)?