pub struct Transaction {
pub meta: HashMap<String, Arc<dyn Any>>,
pub id: u64,
pub steps: Vector<Arc<dyn Step>>,
pub patches: Vector<Vec<Patch>>,
pub doc: Arc<NodePool>,
pub draft: Draft,
pub schema: Arc<Schema>,
}Expand description
事务结构体,用于管理文档的修改操作
Fields§
§meta: HashMap<String, Arc<dyn Any>>存储元数据的哈希表,支持任意类型数据
id: u64事务的时间戳
steps: Vector<Arc<dyn Step>>存储所有操作步骤
patches: Vector<Vec<Patch>>存储每个步骤对应的补丁列表
doc: Arc<NodePool>当前文档状态
draft: Draft文档的草稿状态,用于临时修改
schema: Arc<Schema>文档的模式定义
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub async fn transaction(&mut self, call_back: Arc<dyn Command>)
pub async fn transaction(&mut self, call_back: Arc<dyn Command>)
执行一个事务操作 call_back: 要执行的命令
Sourcepub fn as_concrete(step: &Arc<dyn Step>) -> ConcreteStep
pub fn as_concrete(step: &Arc<dyn Step>) -> ConcreteStep
将步骤转换为具体步骤
Sourcepub fn set_node_attribute(
&mut self,
id: String,
values: HashMap<String, String>,
)
pub fn set_node_attribute( &mut self, id: String, values: HashMap<String, String>, )
设置节点属性 id: 节点ID values: 属性键值对
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl Transform for Transaction
impl Transform for Transaction
impl Send for Transaction
impl Sync for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl !RefUnwindSafe for Transaction
impl Unpin for Transaction
impl !UnwindSafe for Transaction
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