SyncState

Classes > Sync > SyncState

Represents the sync state for a replica. Maps to _sync_state table (Appendix A).

public sealed record SyncState : IEquatable<SyncState>

Example

// Initialize sync state for a new client
var state = new SyncState(
    OriginId: Guid.NewGuid().ToString(),
    LastServerVersion: 0,
    LastPushVersion: 0
);

// After pulling changes from server
var updatedState = state with { LastServerVersion = 142 };

// After pushing changes to server
var finalState = updatedState with { LastPushVersion = 65 };

Constructors

SyncState

public SyncState(string OriginId, long LastServerVersion, long LastPushVersion)

Represents the sync state for a replica. Maps to _sync_state table (Appendix A).

Parameter Type Description
OriginId String UUID v4 identifying this replica. Generated once, never changes.
LastServerVersion Int64 Last version successfully pulled from server.
LastPushVersion Int64 Last local version successfully pushed to server.

Properties

OriginId

public string OriginId { get; init; }

UUID v4 identifying this replica. Generated once, never changes.

LastServerVersion

public long LastServerVersion { get; init; }

Last version successfully pulled from server.

LastPushVersion

public long LastPushVersion { get; init; }

Last local version successfully pushed to server.