feat(native): sync yocto codes (#14243)

#### PR Dependency Tree


* **PR #14243** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Batch management API for coordinated document mutations and change
tracking.
* New document accessors (IDs, state snapshots, change/delete set
queries) and subscriber count.

* **Chores**
  * Upgraded Rust edition across packages to 2024.
  * Repository-wide formatting, stylistic cleanups and test adjustments.

* **Breaking Changes**
* Removed the Node native bindings package and its JS/TS declarations
and tests (no longer published/available).

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-01-11 06:08:33 +08:00
committed by GitHub
parent d515d295ce
commit ca2462f987
143 changed files with 1396 additions and 4841 deletions
+18 -105
View File
@@ -1,5 +1,5 @@
use affine_common::hashcash::Stamp;
use affine_nbstore::{pool::SqliteDocStoragePool, Data};
use affine_nbstore::{Data, pool::SqliteDocStoragePool};
#[derive(uniffi::Error, thiserror::Error, Debug)]
pub enum UniffiError {
@@ -290,22 +290,10 @@ impl DocStoragePool {
}
pub async fn set_space_id(&self, universal_id: String, space_id: String) -> Result<()> {
Ok(
self
.inner
.get(universal_id)
.await?
.set_space_id(space_id)
.await?,
)
Ok(self.inner.get(universal_id).await?.set_space_id(space_id).await?)
}
pub async fn push_update(
&self,
universal_id: String,
doc_id: String,
update: String,
) -> Result<i64> {
pub async fn push_update(&self, universal_id: String, doc_id: String, update: String) -> Result<i64> {
Ok(
self
.inner
@@ -323,11 +311,7 @@ impl DocStoragePool {
)
}
pub async fn get_doc_snapshot(
&self,
universal_id: String,
doc_id: String,
) -> Result<Option<DocRecord>> {
pub async fn get_doc_snapshot(&self, universal_id: String, doc_id: String) -> Result<Option<DocRecord>> {
Ok(
self
.inner
@@ -350,11 +334,7 @@ impl DocStoragePool {
)
}
pub async fn get_doc_updates(
&self,
universal_id: String,
doc_id: String,
) -> Result<Vec<DocUpdate>> {
pub async fn get_doc_updates(&self, universal_id: String, doc_id: String) -> Result<Vec<DocUpdate>> {
Ok(
self
.inner
@@ -368,12 +348,7 @@ impl DocStoragePool {
)
}
pub async fn mark_updates_merged(
&self,
universal_id: String,
doc_id: String,
updates: Vec<i64>,
) -> Result<u32> {
pub async fn mark_updates_merged(&self, universal_id: String, doc_id: String, updates: Vec<i64>) -> Result<u32> {
Ok(
self
.inner
@@ -395,21 +370,10 @@ impl DocStoragePool {
}
pub async fn delete_doc(&self, universal_id: String, doc_id: String) -> Result<()> {
Ok(
self
.inner
.get(universal_id)
.await?
.delete_doc(doc_id)
.await?,
)
Ok(self.inner.get(universal_id).await?.delete_doc(doc_id).await?)
}
pub async fn get_doc_clocks(
&self,
universal_id: String,
after: Option<i64>,
) -> Result<Vec<DocClock>> {
pub async fn get_doc_clocks(&self, universal_id: String, after: Option<i64>) -> Result<Vec<DocClock>> {
Ok(
self
.inner
@@ -431,11 +395,7 @@ impl DocStoragePool {
)
}
pub async fn get_doc_clock(
&self,
universal_id: String,
doc_id: String,
) -> Result<Option<DocClock>> {
pub async fn get_doc_clock(&self, universal_id: String, doc_id: String) -> Result<Option<DocClock>> {
Ok(
self
.inner
@@ -448,34 +408,14 @@ impl DocStoragePool {
}
pub async fn get_blob(&self, universal_id: String, key: String) -> Result<Option<Blob>> {
Ok(
self
.inner
.get(universal_id)
.await?
.get_blob(key)
.await?
.map(Into::into),
)
Ok(self.inner.get(universal_id).await?.get_blob(key).await?.map(Into::into))
}
pub async fn set_blob(&self, universal_id: String, blob: SetBlob) -> Result<()> {
Ok(
self
.inner
.get(universal_id)
.await?
.set_blob(blob.try_into()?)
.await?,
)
Ok(self.inner.get(universal_id).await?.set_blob(blob.try_into()?).await?)
}
pub async fn delete_blob(
&self,
universal_id: String,
key: String,
permanently: bool,
) -> Result<()> {
pub async fn delete_blob(&self, universal_id: String, key: String, permanently: bool) -> Result<()> {
Ok(
self
.inner
@@ -504,11 +444,7 @@ impl DocStoragePool {
)
}
pub async fn get_peer_remote_clocks(
&self,
universal_id: String,
peer: String,
) -> Result<Vec<DocClock>> {
pub async fn get_peer_remote_clocks(&self, universal_id: String, peer: String) -> Result<Vec<DocClock>> {
Ok(
self
.inner
@@ -562,11 +498,7 @@ impl DocStoragePool {
)
}
pub async fn get_peer_pulled_remote_clocks(
&self,
universal_id: String,
peer: String,
) -> Result<Vec<DocClock>> {
pub async fn get_peer_pulled_remote_clocks(&self, universal_id: String, peer: String) -> Result<Vec<DocClock>> {
Ok(
self
.inner
@@ -637,11 +569,7 @@ impl DocStoragePool {
)
}
pub async fn get_peer_pushed_clocks(
&self,
universal_id: String,
peer: String,
) -> Result<Vec<DocClock>> {
pub async fn get_peer_pushed_clocks(&self, universal_id: String, peer: String) -> Result<Vec<DocClock>> {
Ok(
self
.inner
@@ -709,12 +637,7 @@ impl DocStoragePool {
)
}
pub async fn get_blob_uploaded_at(
&self,
universal_id: String,
peer: String,
blob_id: String,
) -> Result<Option<i64>> {
pub async fn get_blob_uploaded_at(&self, universal_id: String, peer: String, blob_id: String) -> Result<Option<i64>> {
Ok(
self
.inner
@@ -753,12 +676,7 @@ impl DocStoragePool {
Ok(())
}
pub async fn fts_delete_document(
&self,
universal_id: String,
index_name: String,
doc_id: String,
) -> Result<()> {
pub async fn fts_delete_document(&self, universal_id: String, index_name: String, doc_id: String) -> Result<()> {
self
.inner
.get(universal_id)
@@ -784,12 +702,7 @@ impl DocStoragePool {
)
}
pub async fn fts_search(
&self,
universal_id: String,
index_name: String,
query: String,
) -> Result<Vec<SearchHit>> {
pub async fn fts_search(&self, universal_id: String, index_name: String, query: String) -> Result<Vec<SearchHit>> {
Ok(
self
.inner