SyncClientRepository
Repository for managing sync clients in SQLite. Implements spec Section 13 (Tombstone Retention) client tracking.
public static class SyncClientRepository
Methods
GetAll(SqliteConnection)
public static Result<IReadOnlyList<SyncClient>, SyncError> GetAll(SqliteConnection connection)
Gets all sync clients from _sync_clients table.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - List of sync clients or database error.
GetByOrigin(SqliteConnection, string)
public static Result<SyncClient?, SyncError> GetByOrigin(SqliteConnection connection, string originId)
Gets a sync client by origin ID.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
originId |
String |
Origin ID to look up. |
Returns: SyncError> - Sync client if found, null if not found, or database error.
Upsert(SqliteConnection, SyncClient)
public static Result<bool, SyncError> Upsert(SqliteConnection connection, SyncClient client)
Upserts a sync client record. Inserts if not exists, updates if exists.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
client |
SyncClient |
Client to upsert. |
Returns: SyncError> - Success or database error.
Delete(SqliteConnection, string)
public static Result<bool, SyncError> Delete(SqliteConnection connection, string originId)
Deletes a sync client by origin ID.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
originId |
String |
Origin ID to delete. |
Returns: SyncError> - Success or database error.
GetMinVersion(SqliteConnection)
public static Result<long, SyncError> GetMinVersion(SqliteConnection connection)
Gets the minimum sync version across all clients. Used for tombstone retention calculation (spec Section 13.4).
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Minimum version or 0 if no clients, or database error.
DeleteMultiple(SqliteConnection, IEnumerable<string>)
public static Result<int, SyncError> DeleteMultiple(SqliteConnection connection, IEnumerable<string> originIds)
Deletes multiple sync clients by origin IDs. Used to clean up stale clients (spec Section 13.5).
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
originIds |
String> |
Origin IDs to delete. |
Returns: SyncError> - Number of deleted clients or database error.