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

Function lock_database

crates/client-api/src/routes/database.rs:1350–1368  ·  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

1348}
1349
1350pub async fn lock_database<S: ControlStateDelegate + Authorization>(
1351 State(ctx): State<S>,
1352 Path(DeleteDatabaseParams { name_or_identity }): Path<DeleteDatabaseParams>,
1353 Extension(auth): Extension<SpacetimeAuth>,
1354) -> axum::response::Result<impl IntoResponse> {
1355 let database_identity = name_or_identity.resolve(&ctx).await?;
1356 let Some(_database) = worker_ctx_find_database(&ctx, &database_identity).await? else {
1357 return Err(StatusCode::NOT_FOUND.into());
1358 };
1359
1360 ctx.authorize_action(auth.claims.identity, database_identity, Action::DeleteDatabase)
1361 .await?;
1362
1363 ctx.set_database_lock(&auth.claims.identity, &database_identity, true)
1364 .await
1365 .map_err(log_and_500)?;
1366
1367 Ok(())
1368}
1369
1370pub async fn unlock_database<S: ControlStateDelegate + Authorization>(
1371 State(ctx): State<S>,

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…