Codex worktree snapshot: settings-delete-targeted
Co-authored-by: Codex
This commit is contained in:
@@ -66,12 +66,16 @@ fn upsert_asset_entity_binding(
|
||||
return Err("asset_entity_binding.asset_object_id 对应的 asset_object 不存在".to_string());
|
||||
}
|
||||
|
||||
// 首版绑定按 entity_kind + entity_id + slot 幂等定位,后续访问量明确后再改为组合索引扫描。
|
||||
let current = ctx.db.asset_entity_binding().iter().find(|row| {
|
||||
row.entity_kind == input.entity_kind
|
||||
&& row.entity_id == input.entity_id
|
||||
&& row.slot == input.slot
|
||||
});
|
||||
let current = ctx
|
||||
.db
|
||||
.asset_entity_binding()
|
||||
.by_entity_slot()
|
||||
.filter((
|
||||
input.entity_kind.as_str(),
|
||||
input.entity_id.as_str(),
|
||||
input.slot.as_str(),
|
||||
))
|
||||
.next();
|
||||
|
||||
let snapshot = match current {
|
||||
Some(existing) => {
|
||||
|
||||
@@ -128,12 +128,12 @@ pub(crate) fn upsert_asset_object(
|
||||
)
|
||||
.map_err(|error| error.to_string())?;
|
||||
|
||||
// 这里先保持最小可发布实现:查重语义已经冻结,后续再把实现优化回组合索引扫描。
|
||||
let current = ctx
|
||||
.db
|
||||
.asset_object()
|
||||
.iter()
|
||||
.find(|row| row.bucket == input.bucket && row.object_key == input.object_key);
|
||||
.by_bucket_object_key()
|
||||
.filter((input.bucket.as_str(), input.object_key.as_str()))
|
||||
.next();
|
||||
|
||||
let snapshot = match current {
|
||||
Some(existing) => {
|
||||
@@ -196,8 +196,9 @@ pub(crate) fn upsert_asset_object(
|
||||
pub(crate) fn has_asset_object(ctx: &ReducerContext, asset_object_id: &str) -> bool {
|
||||
ctx.db
|
||||
.asset_object()
|
||||
.iter()
|
||||
.any(|row| row.asset_object_id == asset_object_id)
|
||||
.asset_object_id()
|
||||
.find(&asset_object_id.to_string())
|
||||
.is_some()
|
||||
}
|
||||
|
||||
fn list_asset_history(
|
||||
@@ -224,8 +225,8 @@ fn list_asset_history(
|
||||
let mut entries = ctx
|
||||
.db
|
||||
.asset_object()
|
||||
.iter()
|
||||
.filter(|row| row.asset_kind == asset_kind)
|
||||
.asset_kind()
|
||||
.filter(&asset_kind.to_string())
|
||||
.map(|row| AssetHistoryEntrySnapshot {
|
||||
asset_object_id: row.asset_object_id,
|
||||
asset_kind: row.asset_kind,
|
||||
|
||||
Reference in New Issue
Block a user