Maintain ref counts for document handles

This commit is contained in:
Antonio Scandurra 2023-08-01 15:07:32 +02:00
parent 7fbe5910b9
commit 50f507e38e
6 changed files with 247 additions and 196 deletions

View file

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