SyncBatch

Classes > Sync > SyncBatch

Represents a batch of changes to be synced. Maps to spec Section 12.

public sealed record SyncBatch : IEquatable<SyncBatch>

Example

// Create a batch with changes
var changes = new List<SyncLogEntry>
{
    new SyncLogEntry(Version: 101, TableName: "patients", ...),
    new SyncLogEntry(Version: 102, TableName: "appointments", ...),
};
var batch = new SyncBatch(
    Changes: changes,
    FromVersion: 100,
    ToVersion: 102,
    HasMore: true
);

// Process batch
if (batch.HasMore)
{
    // Fetch next batch starting from ToVersion
    var nextBatch = await FetchBatch(batch.ToVersion);
}

Constructors

SyncBatch

public SyncBatch(IReadOnlyList<SyncLogEntry> Changes, long FromVersion, long ToVersion, bool HasMore, string? Hash = null)

Represents a batch of changes to be synced. Maps to spec Section 12.

Parameter Type Description
Changes SyncLogEntry> The changes in this batch, ordered by version ascending.
FromVersion Int64 The starting version (exclusive) for this batch.
ToVersion Int64 The ending version (inclusive) for this batch.
HasMore Boolean True if more batches are available after this one.
Hash String Optional SHA-256 hash of batch contents for verification (spec S15.4).

Properties

Changes

public IReadOnlyList<SyncLogEntry> Changes { get; init; }

The changes in this batch, ordered by version ascending.

FromVersion

public long FromVersion { get; init; }

The starting version (exclusive) for this batch.

ToVersion

public long ToVersion { get; init; }

The ending version (inclusive) for this batch.

HasMore

public bool HasMore { get; init; }

True if more batches are available after this one.

Hash

public string? Hash { get; init; }

Optional SHA-256 hash of batch contents for verification (spec S15.4).