MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / unlock_database

Function unlock_database

crates/client-api/src/routes/database.rs:1370–1388  ·  view source on GitHub ↗
(
    State(ctx): State<S>,
    Path(DeleteDatabaseParams { name_or_identity }): Path<DeleteDatabaseParams>,
    Extension(auth): Extension<SpacetimeAuth>,
)

Source from the content-addressed store, hash-verified

1368}
1369
1370pub async fn unlock_database<S: ControlStateDelegate + Authorization>(
1371 State(ctx): State<S>,
1372 Path(DeleteDatabaseParams { name_or_identity }): Path<DeleteDatabaseParams>,
1373 Extension(auth): Extension<SpacetimeAuth>,
1374) -> axum::response::Result<impl IntoResponse> {
1375 let database_identity = name_or_identity.resolve(&ctx).await?;
1376 let Some(_database) = worker_ctx_find_database(&ctx, &database_identity).await? else {
1377 return Err(StatusCode::NOT_FOUND.into());
1378 };
1379
1380 ctx.authorize_action(auth.claims.identity, database_identity, Action::DeleteDatabase)
1381 .await?;
1382
1383 ctx.set_database_lock(&auth.claims.identity, &database_identity, false)
1384 .await
1385 .map_err(log_and_500)?;
1386
1387 Ok(())
1388}
1389
1390#[derive(Deserialize)]
1391pub struct AddNameParams {

Callers

nothing calls this directly

Calls 6

worker_ctx_find_databaseFunction · 0.85
ErrFunction · 0.50
OkFunction · 0.50
resolveMethod · 0.45
authorize_actionMethod · 0.45
set_database_lockMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…