243 lines
6.5 KiB
C#
Executable File
243 lines
6.5 KiB
C#
Executable File
namespace ZB.MOM.WW.CBDDC.Persistence.Snapshot;
|
|
|
|
/// <summary>
|
|
/// Root DTO for CBDDC snapshots (JSON format).
|
|
/// </summary>
|
|
public class SnapshotDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the snapshot format version.
|
|
/// </summary>
|
|
public string Version { get; set; } = "1.0";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the snapshot creation timestamp.
|
|
/// </summary>
|
|
public string CreatedAt { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the source node identifier.
|
|
/// </summary>
|
|
public string NodeId { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the dataset identifier represented by this snapshot payload.
|
|
/// </summary>
|
|
public string DatasetId { get; set; } = "primary";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the serialized document records.
|
|
/// </summary>
|
|
public List<DocumentDto> Documents { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the serialized oplog entries.
|
|
/// </summary>
|
|
public List<OplogDto> Oplog { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the snapshot metadata entries.
|
|
/// </summary>
|
|
public List<SnapshotMetadataDto> SnapshotMetadata { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the remote peer configurations in the snapshot.
|
|
/// </summary>
|
|
public List<RemotePeerDto> RemotePeers { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets peer oplog confirmation records in the snapshot.
|
|
/// </summary>
|
|
public List<PeerOplogConfirmationDto> PeerConfirmations { get; set; } = new();
|
|
}
|
|
|
|
public class DocumentDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the dataset identifier.
|
|
/// </summary>
|
|
public string DatasetId { get; set; } = "primary";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the document collection name.
|
|
/// </summary>
|
|
public string Collection { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the document key.
|
|
/// </summary>
|
|
public string Key { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the serialized document payload.
|
|
/// </summary>
|
|
public string? JsonData { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether the document is deleted.
|
|
/// </summary>
|
|
public bool IsDeleted { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC wall-clock component.
|
|
/// </summary>
|
|
public long HlcWall { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC logical counter component.
|
|
/// </summary>
|
|
public int HlcLogic { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC node component.
|
|
/// </summary>
|
|
public string HlcNode { get; set; } = "";
|
|
}
|
|
|
|
public class OplogDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the dataset identifier.
|
|
/// </summary>
|
|
public string DatasetId { get; set; } = "primary";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the collection associated with the operation.
|
|
/// </summary>
|
|
public string Collection { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the key associated with the operation.
|
|
/// </summary>
|
|
public string Key { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the operation code.
|
|
/// </summary>
|
|
public int Operation { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the serialized operation payload.
|
|
/// </summary>
|
|
public string? JsonData { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC wall-clock component.
|
|
/// </summary>
|
|
public long HlcWall { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC logical counter component.
|
|
/// </summary>
|
|
public int HlcLogic { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC node component.
|
|
/// </summary>
|
|
public string HlcNode { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the current entry hash.
|
|
/// </summary>
|
|
public string Hash { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the previous entry hash.
|
|
/// </summary>
|
|
public string? PreviousHash { get; set; }
|
|
}
|
|
|
|
public class SnapshotMetadataDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the dataset identifier.
|
|
/// </summary>
|
|
public string DatasetId { get; set; } = "primary";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the node identifier.
|
|
/// </summary>
|
|
public string NodeId { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC wall-clock component.
|
|
/// </summary>
|
|
public long HlcWall { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HLC logical counter component.
|
|
/// </summary>
|
|
public int HlcLogic { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the metadata hash.
|
|
/// </summary>
|
|
public string Hash { get; set; } = "";
|
|
}
|
|
|
|
public class RemotePeerDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the remote node identifier.
|
|
/// </summary>
|
|
public string NodeId { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the remote peer address.
|
|
/// </summary>
|
|
public string Address { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the peer type.
|
|
/// </summary>
|
|
public int Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether the peer is enabled.
|
|
/// </summary>
|
|
public bool IsEnabled { get; set; }
|
|
}
|
|
|
|
public class PeerOplogConfirmationDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the dataset identifier.
|
|
/// </summary>
|
|
public string DatasetId { get; set; } = "primary";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the tracked peer node identifier.
|
|
/// </summary>
|
|
public string PeerNodeId { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the source node identifier.
|
|
/// </summary>
|
|
public string SourceNodeId { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the confirmed HLC wall-clock component.
|
|
/// </summary>
|
|
public long ConfirmedWall { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the confirmed HLC logical counter component.
|
|
/// </summary>
|
|
public int ConfirmedLogic { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the confirmed oplog hash.
|
|
/// </summary>
|
|
public string ConfirmedHash { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the last-confirmed timestamp in Unix milliseconds.
|
|
/// </summary>
|
|
public long LastConfirmedUtcMs { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether the tracked peer is active.
|
|
/// </summary>
|
|
public bool IsActive { get; set; }
|
|
}
|