Remove new_with_actor_id on documents
This commit is contained in:
parent
8eea9d7c0b
commit
30e0748c15
3 changed files with 6 additions and 25 deletions
automerge
|
@ -44,13 +44,6 @@ impl AutoCommit {
|
|||
self.doc.get_actor()
|
||||
}
|
||||
|
||||
pub fn new_with_actor_id(actor: ActorId) -> Self {
|
||||
Self {
|
||||
doc: Automerge::new_with_actor_id(actor),
|
||||
transaction: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn ensure_transaction_open(&mut self) {
|
||||
if self.transaction.is_none() {
|
||||
let actor = self.doc.actor;
|
||||
|
|
|
@ -61,22 +61,6 @@ impl Automerge {
|
|||
&self.ops.m.actors[self.actor]
|
||||
}
|
||||
|
||||
pub fn new_with_actor_id(actor: ActorId) -> Self {
|
||||
let mut am = Automerge {
|
||||
queue: vec![],
|
||||
history: vec![],
|
||||
history_index: HashMap::new(),
|
||||
states: HashMap::new(),
|
||||
ops: Default::default(),
|
||||
deps: Default::default(),
|
||||
saved: Default::default(),
|
||||
actor: 0,
|
||||
max_op: 0,
|
||||
};
|
||||
am.actor = am.ops.m.actors.cache(actor);
|
||||
am
|
||||
}
|
||||
|
||||
/// Start a transaction.
|
||||
pub fn transaction(&mut self) -> Transaction {
|
||||
let actor = self.actor;
|
||||
|
|
|
@ -7,11 +7,15 @@ use std::{
|
|||
use serde::ser::{SerializeMap, SerializeSeq};
|
||||
|
||||
pub fn new_doc() -> automerge::AutoCommit {
|
||||
automerge::AutoCommit::new_with_actor_id(automerge::ActorId::random())
|
||||
let mut d = automerge::AutoCommit::new();
|
||||
d.set_actor(automerge::ActorId::random());
|
||||
d
|
||||
}
|
||||
|
||||
pub fn new_doc_with_actor(actor: automerge::ActorId) -> automerge::AutoCommit {
|
||||
automerge::AutoCommit::new_with_actor_id(actor)
|
||||
let mut d = automerge::AutoCommit::new();
|
||||
d.set_actor(actor);
|
||||
d
|
||||
}
|
||||
|
||||
/// Returns two actor IDs, the first considered to be ordered before the second
|
||||
|
|
Loading…
Add table
Reference in a new issue