SyncLogEntry

Classes > Sync > SyncLogEntry

Represents a single entry in the unified change log (_sync_log). Maps to spec Section 7.2 schema.

public sealed record SyncLogEntry : IEquatable<SyncLogEntry>

Example

// Create an insert entry for a new patient record
var insertEntry = new SyncLogEntry(
    Version: 1,
    TableName: "patients",
    PkValue: "{\"Id\": \"550e8400-e29b-41d4-a716-446655440000\"}",
    Operation: SyncOperation.Insert,
    Payload: "{\"Id\": \"550e8400-e29b-41d4-a716-446655440000\", \"Name\": \"John Doe\"}",
    Origin: "client-uuid-123",
    Timestamp: DateTime.UtcNow.ToString("o")
);

// Create a delete entry (tombstone)
var deleteEntry = new SyncLogEntry(
    Version: 2,
    TableName: "patients",
    PkValue: "{\"Id\": \"550e8400-e29b-41d4-a716-446655440000\"}",
    Operation: SyncOperation.Delete,
    Payload: null,
    Origin: "client-uuid-123",
    Timestamp: DateTime.UtcNow.ToString("o")
);

Constructors

SyncLogEntry

public SyncLogEntry(long Version, string TableName, string PkValue, SyncOperation Operation, string? Payload, string Origin, string Timestamp)

Represents a single entry in the unified change log (_sync_log). Maps to spec Section 7.2 schema.

Parameter Type Description
Version Int64 Monotonically increasing version number (PRIMARY KEY).
TableName String Name of the table where the change occurred.
PkValue String JSON-serialized primary key value, e.g. {"Id": "uuid-here"}.
Operation SyncOperation Type of operation: insert, update, or delete.
Payload String JSON-serialized row data. NULL for deletes.
Origin String UUID of the replica that created this change.
Timestamp String ISO 8601 UTC timestamp with milliseconds.

Properties

Version

public long Version { get; init; }

Monotonically increasing version number (PRIMARY KEY).

TableName

public string TableName { get; init; }

Name of the table where the change occurred.

PkValue

public string PkValue { get; init; }

JSON-serialized primary key value, e.g. {"Id": "uuid-here"}.

Operation

public SyncOperation Operation { get; init; }

Type of operation: insert, update, or delete.

Payload

public string? Payload { get; init; }

JSON-serialized row data. NULL for deletes.

Origin

public string Origin { get; init; }

UUID of the replica that created this change.

Timestamp

public string Timestamp { get; init; }

ISO 8601 UTC timestamp with milliseconds.