feat: native sync state (#14190)

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

## Summary by CodeRabbit

* **New Features**
* Added indexed clock management capabilities for documents, enabling
get, set, and clear operations across Android, iOS, Electron, and web
platforms.

* **Refactor**
* Improved storage architecture to dynamically select platform-specific
implementations (SQLite for Electron, IndexedDB for others).

* **Bug Fixes**
* Enhanced document operations to properly maintain and clean up indexer
synchronization state during document lifecycle changes.

<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
2025-12-31 04:09:32 +08:00
committed by GitHub
parent 95ef04f3e0
commit 99332228da
18 changed files with 375 additions and 12 deletions

View File

@@ -82,6 +82,18 @@ CREATE TABLE idx_snapshots (
index_name TEXT PRIMARY KEY NOT NULL,
data BLOB NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);
"#,
None,
),
// add indexer sync table
(
"add_indexer_sync",
r#"
CREATE TABLE "indexer_sync" (
doc_id VARCHAR PRIMARY KEY NOT NULL,
indexed_clock TIMESTAMP NOT NULL DEFAULT 0,
indexer_version INTEGER NOT NULL DEFAULT 0
);
"#,
None,