Skip to content

PgLsn

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Represents a position in PostgreSQL’s write-ahead log, as the pg_lsn type holds it.

public readonly struct PgLsn : IComparable<PgLsn>, IComparable, ISpanFormattable, IFormattable, ISpanParsable<PgLsn>, IParsable<PgLsn>, IEquatable<PgLsn>

The text form is two hexadecimal numbers, the high and low 32 bits, as in 16/B374D848. ToString() writes them without padding, as PostgreSQL 13–18, Npgsql and rust-postgres do; PostgreSQL 19 pads the low half to eight digits. Parsing accepts both forms, and so does every supported PostgreSQL version.

Implements: IComparable<PgLsn>, IComparable, ISpanFormattable, IFormattable, ISpanParsable<PgLsn>, IParsable<PgLsn>, IEquatable<PgLsn>

Represents a position in PostgreSQL’s write-ahead log, as the pg_lsn type holds it.

public PgLsn(ulong Value)

Parameters:

Value — ulong

The byte position.

The text form is two hexadecimal numbers, the high and low 32 bits, as in 16/B374D848. ToString() writes them without padding, as PostgreSQL 13–18, Npgsql and rust-postgres do; PostgreSQL 19 pads the low half to eight digits. Parsing accepts both forms, and so does every supported PostgreSQL version.

public int CompareTo(PgLsn other)

Parameters:

other — PgLsn

Returns: int

public int CompareTo(object? obj)

Parameters:

obj — object

Returns: int

public void Deconstruct(out ulong Value)

Parameters:

Value — ulong

public bool Equals(PgLsn other)

Parameters:

other — PgLsn

Returns: bool

public override bool Equals(object obj)

Parameters:

obj — object

Returns: bool

public override int GetHashCode()

Returns: int

Parses PostgreSQL’s text form, which does not depend on culture.

public static PgLsn Parse(ReadOnlySpan<char> s)

Parameters:

s — ReadOnlySpan<char>

The text, such as 16/B374D848.

Returns: PgLsn

The position.

Exceptions:

Parses PostgreSQL’s text form, which does not depend on culture.

public static PgLsn Parse(string s)

Parameters:

s — string

The text, such as 16/B374D848.

Returns: PgLsn

The position.

Exceptions:

Formats the position as PostgreSQL does, such as 16/B374D848.

public override string ToString()

Returns: string

The text form.

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters:

format — string

formatProvider — IFormatProvider

Returns: string

TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)

Section titled “TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)”
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

Parameters:

destination — Span<char>

charsWritten — int

format — ReadOnlySpan<char>

provider — IFormatProvider

Returns: bool

Parses PostgreSQL’s text form, which does not depend on culture.

public static bool TryParse(ReadOnlySpan<char> s, out PgLsn result)

Parameters:

s — ReadOnlySpan<char>

The text, such as 16/B374D848.

result — PgLsn

The position, or the invalid position when parsing fails.

Returns: bool

Whether the text is a position.

Parses PostgreSQL’s text form, which does not depend on culture.

public static bool TryParse(string? s, out PgLsn result)

Parameters:

s — string

The text, such as 16/B374D848.

result — PgLsn

The position, or the invalid position when parsing fails.

Returns: bool

Whether the text is a position.

Gets the invalid position, 0/0.

public static PgLsn Invalid { get; }

Value: PgLsn

Gets whether the position is valid.

public bool IsValid { get; }

Value: bool

The byte position.

public ulong Value { get; init; }

Value: ulong

public static bool operator ==(PgLsn left, PgLsn right)

Parameters:

left — PgLsn

right — PgLsn

Returns: bool

Compares two positions.

public static bool operator >(PgLsn left, PgLsn right)

Parameters:

left — PgLsn

The first position.

right — PgLsn

The second position.

Returns: bool

Whether left comes later.

Compares two positions.

public static bool operator >=(PgLsn left, PgLsn right)

Parameters:

left — PgLsn

The first position.

right — PgLsn

The second position.

Returns: bool

Whether left does not come first.

public static bool operator !=(PgLsn left, PgLsn right)

Parameters:

left — PgLsn

right — PgLsn

Returns: bool

Compares two positions.

public static bool operator <(PgLsn left, PgLsn right)

Parameters:

left — PgLsn

The first position.

right — PgLsn

The second position.

Returns: bool

Whether left comes first.

Compares two positions.

public static bool operator <=(PgLsn left, PgLsn right)

Parameters:

left — PgLsn

The first position.

right — PgLsn

The second position.

Returns: bool

Whether left does not come later.