Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl DatabaseDriver for PostgresDatabaseDriver {
Err(e) => e,
},
Ok(Err(e)) => e,
Err(e) => anyhow::Error::from(DatabaseError::TransactionTooOld),
Err(_) => anyhow::Error::from(DatabaseError::TransactionTooOld),
};

let chain = error
Expand Down
17 changes: 0 additions & 17 deletions packages/core/api-public/src/runner_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,6 @@ async fn upsert_inner(
.await?
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?;

// Upsert default to epoxy
if let Some(default_config) = body.0.remove("default") {
ctx.op(namespace::ops::runner_config::upsert_default::Input {
namespace_id: namespace.namespace_id,
name: path.runner_name.clone(),
config: default_config.into(),
})
.await?;
}

for dc in &ctx.config().topology().datacenters {
if let Some(runner_config) = body.0.remove(&dc.name) {
if ctx.config().dc_label() == dc.datacenter_label {
Expand Down Expand Up @@ -274,12 +264,5 @@ async fn delete_inner(
}
}

// Delete default from epoxy
ctx.op(namespace::ops::runner_config::delete_default::Input {
namespace_id: namespace.namespace_id,
name: path.runner_name.clone(),
})
.await?;

Ok(DeleteResponse {})
}
52 changes: 0 additions & 52 deletions packages/services/namespace/src/keys/runner_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,55 +206,3 @@ impl TuplePack for ByVariantSubspaceKey {
Ok(offset)
}
}

#[derive(Debug)]
pub struct DefaultKey {
pub namespace_id: Id,
pub name: String,
}

impl DefaultKey {
pub fn new(namespace_id: Id, name: String) -> Self {
DefaultKey { namespace_id, name }
}
}

impl FormalKey for DefaultKey {
type Value = rivet_types::runner_configs::RunnerConfig;

fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
Ok(
rivet_data::versioned::NamespaceRunnerConfig::deserialize_with_embedded_version(raw)?
.into(),
)
}

fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
rivet_data::versioned::NamespaceRunnerConfig::latest(value.into())
.serialize_with_embedded_version(
rivet_data::PEGBOARD_NAMESPACE_RUNNER_ALLOC_IDX_VERSION,
)
}
}

impl TuplePack for DefaultKey {
fn pack<W: std::io::Write>(
&self,
w: &mut W,
tuple_depth: TupleDepth,
) -> std::io::Result<VersionstampOffset> {
let t = (RUNNER, CONFIG, DEFAULT, self.namespace_id, &self.name);
t.pack(w, tuple_depth)
}
}

impl<'de> TupleUnpack<'de> for DefaultKey {
fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
let (input, (_, _, _, namespace_id, name)) =
<(usize, usize, usize, Id, String)>::unpack(input, tuple_depth)?;

let v = DefaultKey { namespace_id, name };

Ok((input, v))
}
}

This file was deleted.

22 changes: 2 additions & 20 deletions packages/services/namespace/src/ops/runner_config/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub struct RunnerConfig {
pub namespace_id: Id,
pub name: String,
pub config: rivet_types::runner_configs::RunnerConfig,
pub is_default: bool,
}

#[operation]
Expand All @@ -36,34 +35,17 @@ pub async fn namespace_runner_config_get(
let runner_config_key =
keys::runner_config::DataKey::new(namespace_id, runner_name.clone());

// Runner config not found
let Some(runner_config) =
tx.read_opt(&runner_config_key, Serializable).await?
else {
let default_config = ctx
.op(crate::ops::runner_config::get_default::Input {
namespace_id,
name: runner_name.clone(),
})
.await?;

let Some(default_config) = default_config else {
return Ok(None);
};

return Ok(Some(RunnerConfig {
namespace_id,
name: runner_name,
config: default_config,
is_default: true,
}));
// Runner config not found
return Ok(None);
};

Ok(Some(RunnerConfig {
namespace_id,
name: runner_name,
config: runner_config,
is_default: false,
}))
}
})
Expand Down
33 changes: 0 additions & 33 deletions packages/services/namespace/src/ops/runner_config/get_default.rs

This file was deleted.

3 changes: 0 additions & 3 deletions packages/services/namespace/src/ops/runner_config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
pub mod delete;
pub mod delete_default;
pub mod get;
pub mod get_default;
pub mod list;
pub mod upsert;
pub mod upsert_default;

This file was deleted.

Loading