pub enum StorageOp {
BatchUpsert(UpsertSpec),
MonotonicUpsert(MonotonicUpsertSpec),
BatchUpdate(BatchUpdateSpec),
GuardedBump(GuardedBumpSpec),
ScopedGuardedBump(ScopedGuardedBumpSpec),
Get(GetSpec),
ScopedGet(ScopedGetSpec),
Scan(ScanSpec),
BatchDelete(BatchDeleteSpec),
}Expand description
存储操作(具体 SQL 由 driver 的 Storage 实现构造)
Variants§
BatchUpsert(UpsertSpec)
batch upsert:INSERT … ON CONFLICT(conflict_key) DO UPDATE …
MonotonicUpsert(MonotonicUpsertSpec)
通用单调 MAX-guard 写:仅当 new value > 当前值才写(CAS / 单调寄存器语义,严格 >)。
BatchUpdate(BatchUpdateSpec)
batch update:UPDATE table SET patch WHERE key_col IN (key_vals)
GuardedBump(GuardedBumpSpec)
守卫式自增:UPDATE … SET bump_col = bump_col + delta[, set…] WHERE key=? AND ? > guard_col。
通用计数器原语(无 read-modify-write),见 GuardedBumpSpec。
ScopedGuardedBump(ScopedGuardedBumpSpec)
复合作用域守卫式自增:在 scope + key 精确单行内完成幂等计数与绝对列写。
Get(GetSpec)
get:SELECT * FROM table WHERE …(单行)
ScopedGet(ScopedGetSpec)
复合作用域 get:SELECT * FROM table WHERE scope=? AND key=?(单行)
Scan(ScanSpec)
scan:SELECT * FROM table [LIMIT n](多行,C3)
BatchDelete(BatchDeleteSpec)
batch delete:DELETE FROM table WHERE scope_col = ? AND key_col IN (key_vals)。
复合 PK 作用域删除(如 channel_member 成员离场:scope=channel_id + key=user_id)。
O(k) 单语句;scope 等值约束绝不跨作用域误删。见 BatchDeleteSpec。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StorageOp
impl RefUnwindSafe for StorageOp
impl Send for StorageOp
impl Sync for StorageOp
impl Unpin for StorageOp
impl UnsafeUnpin for StorageOp
impl UnwindSafe for StorageOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more