SyncLogRepository
Static methods for sync log operations. FP-style - no instance state, pure functions. Implements spec Section 7 (Unified Change Log) and Section 12 (Batching).
public static class SyncLogRepository
Methods
FetchChanges(SqliteConnection, long, int)
public static Result<IReadOnlyList<SyncLogEntry>, SyncError> FetchChanges(SqliteConnection connection, long fromVersion, int batchSize)
Fetches a batch of changes from the sync log.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
fromVersion |
Int64 |
Fetch changes with version greater than this. |
batchSize |
Int32 |
Maximum number of changes to fetch. |
Returns: SyncError> - List of sync log entries or database error.
GetLastServerVersion(SqliteConnection)
public static Result<long, SyncError> GetLastServerVersion(SqliteConnection connection)
Gets the last server version from sync state.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Last server version or database error.
UpdateLastServerVersion(SqliteConnection, long)
public static Result<bool, SyncError> UpdateLastServerVersion(SqliteConnection connection, long version)
Updates the last server version in sync state.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
version |
Int64 |
New last server version. |
Returns: SyncError> - Success or database error.
GetMaxVersion(SqliteConnection)
public static Result<long, SyncError> GetMaxVersion(SqliteConnection connection)
Gets the maximum version in the sync log.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Max version or 0 if no entries.
GetMinVersion(SqliteConnection)
public static Result<long, SyncError> GetMinVersion(SqliteConnection connection)
Gets the minimum version in the sync log. Used for tombstone retention checks (spec Section 13.6).
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Min version or 0 if no entries.
GetEntryCount(SqliteConnection)
public static Result<long, SyncError> GetEntryCount(SqliteConnection connection)
Gets total count of entries in the sync log.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Count or database error.