Remove new_with_actor_id on documents

This commit is contained in:
Andrew Jeffery 2022-03-02 17:02:26 +00:00
parent 8eea9d7c0b
commit 30e0748c15
3 changed files with 6 additions and 25 deletions
automerge

View file

@ -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;

View file

@ -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;

View file

@ -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