JMAP for Calendars implementation (part 4)

This commit is contained in:
mdecimus
2025-10-09 19:02:33 +02:00
parent ec4963f46b
commit b84e3e85dd
56 changed files with 2008 additions and 355 deletions

View File

@@ -447,6 +447,14 @@ impl BatchBuilder {
self.current_account_id
}
pub fn last_collection(&self) -> Option<Collection> {
self.current_collection
}
pub fn last_document_id(&self) -> Option<u32> {
self.current_document_id
}
pub fn commit_points(&mut self) -> CommitPointIterator {
self.serialize_changes();
CommitPointIterator {

View File

@@ -5,7 +5,7 @@
*/
use std::convert::TryInto;
use types::blob_hash::BLOB_HASH_LEN;
use types::{blob_hash::BLOB_HASH_LEN, collection::SyncCollection};
use utils::codec::leb128::Leb128_;
use crate::{
@@ -435,6 +435,13 @@ impl ValueClass {
},
ValueClass::DocumentId => serializer.write(account_id).write(collection),
ValueClass::ChangeId => serializer.write(account_id),
ValueClass::ShareNotification {
notification_id,
notify_account_id,
} => serializer
.write(*notify_account_id)
.write(u8::from(SyncCollection::ShareNotification))
.write(*notification_id),
ValueClass::Any(any) => serializer.write(any.key.as_slice()),
}
.finalize()
@@ -626,6 +633,7 @@ impl ValueClass {
},
ValueClass::DocumentId => U32_LEN + 1,
ValueClass::ChangeId => U32_LEN,
ValueClass::ShareNotification { .. } => U32_LEN + U64_LEN + 1,
ValueClass::Any(v) => v.key.len(),
}
}
@@ -673,6 +681,7 @@ impl ValueClass {
TelemetryClass::Metric { .. } => SUBSPACE_TELEMETRY_METRIC,
},
ValueClass::DocumentId | ValueClass::ChangeId => SUBSPACE_COUNTER,
ValueClass::ShareNotification { .. } => SUBSPACE_LOGS,
ValueClass::Any(any) => any.subspace,
}
}

View File

@@ -194,6 +194,10 @@ pub enum ValueClass {
Report(ReportClass),
Telemetry(TelemetryClass),
Any(AnyClass),
ShareNotification {
notification_id: u64,
notify_account_id: u32,
},
DocumentId,
ChangeId,
}