Maintain ref counts for document handles
This commit is contained in:
parent
7fbe5910b9
commit
50f507e38e
6 changed files with 247 additions and 196 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
operations::{CreateBranch, CreateDocument, Edit},
|
||||
OperationCount, OperationId, ReplicaId, RepoId, Request, RevisionId, RoomCredentials,
|
||||
BranchId, OperationCount, OperationId, ReplicaId, RepoId, Request, RevisionId, RoomCredentials,
|
||||
};
|
||||
use collections::BTreeMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -141,6 +141,14 @@ impl Operation {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn branch_id(&self) -> BranchId {
|
||||
match self {
|
||||
Operation::CreateBranch(op) => op.id,
|
||||
Operation::CreateDocument(op) => op.branch_id,
|
||||
Operation::Edit(op) => op.branch_id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parent(&self) -> &RevisionId {
|
||||
match self {
|
||||
Operation::CreateDocument(op) => &op.parent,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue