Skip to content

Commit 9bfcca3

Browse files
glommerclaude
andcommitted
Deprecate sync(), sync_until(), and sync_frames() APIs
Mark the sync family of functions as deprecated across the Rust public API and the C header bindings. Users are directed to the `turso` crate as a replacement. Learn more: https://tur.so/newsync Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e4beaca commit 9bfcca3

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

bindings/c/include/libsql.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,24 @@ typedef struct {
5959
int len;
6060
} blob;
6161

62+
#if defined(__GNUC__) || defined(__clang__)
63+
#define LIBSQL_DEPRECATED(msg) __attribute__((deprecated(msg)))
64+
#elif defined(_MSC_VER)
65+
#define LIBSQL_DEPRECATED(msg) __declspec(deprecated(msg))
66+
#else
67+
#define LIBSQL_DEPRECATED(msg)
68+
#endif
69+
6270
#ifdef __cplusplus
6371
extern "C" {
6472
#endif // __cplusplus
6573

6674
int libsql_enable_internal_tracing(void);
6775

76+
LIBSQL_DEPRECATED("sync() is deprecated and will be removed in a future release. Learn more: https://tur.so/newsync")
6877
int libsql_sync(libsql_database_t db, const char **out_err_msg);
6978

79+
LIBSQL_DEPRECATED("sync() is deprecated and will be removed in a future release. Learn more: https://tur.so/newsync")
7080
int libsql_sync2(libsql_database_t db, replicated *out_replicated, const char **out_err_msg);
7181

7282
int libsql_open_sync(const char *db_path,

libsql/src/database.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ cfg_replication! {
394394

395395
/// Sync database from remote, and returns the committed frame_no after syncing, if
396396
/// applicable.
397+
#[deprecated(note = "sync() is deprecated and will be removed in a future release. Use the `turso` crate instead. Learn more: https://tur.so/newsync")]
397398
pub async fn sync(&self) -> Result<Replicated> {
398399
match &self.db_type {
399400
#[cfg(feature = "replication")]
@@ -413,6 +414,7 @@ cfg_replication! {
413414

414415
/// Sync database from remote until it gets to a given replication_index or further,
415416
/// and returns the committed frame_no after syncing, if applicable.
417+
#[deprecated(note = "sync_until() is deprecated and will be removed in a future release. Use the `turso` crate instead. Learn more: https://tur.so/newsync")]
416418
pub async fn sync_until(&self, replication_index: FrameNo) -> Result<Replicated> {
417419
if let DbType::Sync { db, encryption_config: _ } = &self.db_type {
418420
db.sync_until(replication_index).await
@@ -423,6 +425,7 @@ cfg_replication! {
423425

424426
/// Apply a set of frames to the database and returns the committed frame_no after syncing, if
425427
/// applicable.
428+
#[deprecated(note = "sync_frames() is deprecated and will be removed in a future release. Use the `turso` crate instead. Learn more: https://tur.so/newsync")]
426429
pub async fn sync_frames(&self, frames: crate::replication::Frames) -> Result<Option<FrameNo>> {
427430
if let DbType::Sync { db, encryption_config: _ } = &self.db_type {
428431
db.sync_frames(frames).await

0 commit comments

Comments
 (0)