mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Adapt run intents to activated blob storage
Use the synchronous blob authority established at server startup and remove the obsolete per-request store-open error path.
This commit is contained in:
parent
776e719383
commit
0e580f0a43
3 changed files with 9 additions and 21 deletions
|
|
@ -16,11 +16,6 @@ use crate::run_compiler::{RunCompilerError, settings_layer_with_resolved_dockerf
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub(crate) enum RunIntentAdmissionError {
|
||||
#[error("workflow-version storage could not be opened")]
|
||||
StoreOpen {
|
||||
#[source]
|
||||
source: fabro_store::Error,
|
||||
},
|
||||
#[error("workflow-version closure could not be loaded")]
|
||||
VersionStore {
|
||||
#[source]
|
||||
|
|
@ -385,7 +380,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn lowers_nested_entrypoints_and_inlines_goal_files() {
|
||||
let (database, _) = crate::test_support::test_store_bundle();
|
||||
let blobs = database.blobs().await.unwrap();
|
||||
let blobs = database.blobs();
|
||||
let store = WorkflowVersionStore::new(blobs);
|
||||
let grandchild = version(
|
||||
"deep/leaf.fabro",
|
||||
|
|
@ -453,7 +448,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn lowers_same_version_at_distinct_mount_paths() {
|
||||
let (database, _) = crate::test_support::test_store_bundle();
|
||||
let blobs = database.blobs().await.unwrap();
|
||||
let blobs = database.blobs();
|
||||
let store = WorkflowVersionStore::new(blobs);
|
||||
let child = version(
|
||||
"pkg/child.fabro",
|
||||
|
|
@ -494,7 +489,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn rejects_closures_that_expand_past_the_mount_limit() {
|
||||
let (database, _) = crate::test_support::test_store_bundle();
|
||||
let blobs = database.blobs().await.unwrap();
|
||||
let blobs = database.blobs();
|
||||
let store = WorkflowVersionStore::new(blobs);
|
||||
// A chain of tiny versions where each level mounts the next twice is
|
||||
// cheap to store and load (the closure dedupes by id) but expands to
|
||||
|
|
@ -527,7 +522,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn rejects_distinct_versions_that_converge_on_one_mount_path() {
|
||||
let (database, _) = crate::test_support::test_store_bundle();
|
||||
let blobs = database.blobs().await.unwrap();
|
||||
let blobs = database.blobs();
|
||||
let store = WorkflowVersionStore::new(blobs);
|
||||
let first_leaf = version(
|
||||
"leaf/first.fabro",
|
||||
|
|
@ -584,7 +579,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn rejects_rebased_files_that_escape_the_runtime_root() {
|
||||
let (database, _) = crate::test_support::test_store_bundle();
|
||||
let blobs = database.blobs().await.unwrap();
|
||||
let blobs = database.blobs();
|
||||
let store = WorkflowVersionStore::new(blobs);
|
||||
let child = version(
|
||||
"nested/child.fabro",
|
||||
|
|
|
|||
|
|
@ -624,12 +624,7 @@ async fn create_run_from_intent(
|
|||
Ok(id) => id,
|
||||
Err(error) => return run_intent_admission_error(error.into()),
|
||||
};
|
||||
let blobs = match state.store_ref().blobs().await {
|
||||
Ok(blobs) => blobs,
|
||||
Err(source) => {
|
||||
return run_intent_admission_error(RunIntentAdmissionError::StoreOpen { source });
|
||||
}
|
||||
};
|
||||
let blobs = state.store_ref().blobs();
|
||||
let version_store = fabro_workflow_version::WorkflowVersionStore::new(blobs);
|
||||
let closure = match version_store.get_closure(&intent.workflow_version_id).await {
|
||||
Ok(Some(closure)) => closure,
|
||||
|
|
@ -964,8 +959,7 @@ fn intent_error(status: StatusCode, detail: impl Into<String>, code: &'static st
|
|||
|
||||
fn run_intent_admission_error(error: RunIntentAdmissionError) -> Response {
|
||||
match &error {
|
||||
RunIntentAdmissionError::StoreOpen { .. }
|
||||
| RunIntentAdmissionError::VersionStore { .. }
|
||||
RunIntentAdmissionError::VersionStore { .. }
|
||||
| RunIntentAdmissionError::VariableSnapshot { .. }
|
||||
| RunIntentAdmissionError::Environment(EnvironmentSelectionError::CredentialStore {
|
||||
..
|
||||
|
|
@ -987,8 +981,7 @@ fn run_intent_admission_error(error: RunIntentAdmissionError) -> Response {
|
|||
}
|
||||
|
||||
match error {
|
||||
RunIntentAdmissionError::StoreOpen { .. }
|
||||
| RunIntentAdmissionError::VersionStore { .. } => intent_error(
|
||||
RunIntentAdmissionError::VersionStore { .. } => intent_error(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"workflow version store operation failed",
|
||||
"workflow_version_store_error",
|
||||
|
|
|
|||
|
|
@ -3574,7 +3574,7 @@ async fn store_workflow_version(
|
|||
)
|
||||
.unwrap();
|
||||
let version = fabro_workflow_version::ValidatedWorkflowVersion::new(version).unwrap();
|
||||
let blobs = state.store_ref().blobs().await.unwrap();
|
||||
let blobs = state.store_ref().blobs();
|
||||
fabro_workflow_version::WorkflowVersionStore::new(blobs)
|
||||
.put(&version)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue