forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReplicationSlotOptions.cs
More file actions
59 lines (52 loc) · 1.93 KB
/
ReplicationSlotOptions.cs
File metadata and controls
59 lines (52 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using NpgsqlTypes;
namespace Npgsql.Replication;
/// <summary>
/// Contains information about a replication slot.
/// </summary>
public readonly struct ReplicationSlotOptions
{
/// <summary>
/// Creates a new <see cref="ReplicationSlotOptions"/> instance.
/// </summary>
/// <param name="slotName">
/// The name of the replication slot.
/// </param>
/// <param name="consistentPoint">
/// The WAL location at which the slot became consistent.
/// </param>
public ReplicationSlotOptions(string slotName, string? consistentPoint = null)
: this(slotName, consistentPoint is null ? default : NpgsqlLogSequenceNumber.Parse(consistentPoint), null){}
/// <summary>
/// Creates a new <see cref="ReplicationSlotOptions"/> instance.
/// </summary>
/// <param name="slotName">
/// The name of the replication slot.
/// </param>
/// <param name="consistentPoint">
/// The WAL location at which the slot became consistent.
/// </param>
public ReplicationSlotOptions(string slotName, NpgsqlLogSequenceNumber consistentPoint)
: this(slotName, consistentPoint, null) {}
internal ReplicationSlotOptions(
string slotName,
NpgsqlLogSequenceNumber consistentPoint,
string? snapshotName)
{
SlotName = slotName ?? throw new ArgumentNullException(nameof(slotName), "The replication slot name cannot be null.");
ConsistentPoint = consistentPoint;
SnapshotName = snapshotName;
}
/// <summary>
/// The name of the replication slot.
/// </summary>
public string SlotName { get; }
/// <summary>
/// The WAL location at which the slot became consistent.
/// </summary>
public NpgsqlLogSequenceNumber ConsistentPoint { get; }
/// <summary>
/// The identifier of the snapshot exported by the CREATE_REPLICATION_SLOT command.
/// </summary>
internal string? SnapshotName { get; }
}