confluent-kafka-dotnet
Show / Hide Table of Contents

Struct Offset

Represents a Kafka partition offset value.

Implements
IEquatable<Offset>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: Confluent.Kafka
Assembly: Confluent.Kafka.dll
Syntax
public struct Offset : IEquatable<Offset>
Remarks

This structure is the same size as a long - its purpose is to add some syntactical sugar related to special values.

Constructors

Offset(long)

Initializes a new instance of the Offset structure.

Declaration
public Offset(long offset)
Parameters
TypeNameDescription
longoffset

The offset value

Fields

Beginning

A special value that refers to the beginning of a partition.

Declaration
public static readonly Offset Beginning
Field Value
TypeDescription
Offset

End

A special value that refers to the end of a partition.

Declaration
public static readonly Offset End
Field Value
TypeDescription
Offset

Stored

A special value that refers to the stored offset for a partition.

Declaration
public static readonly Offset Stored
Field Value
TypeDescription
Offset

Unset

A special value that refers to an invalid, unassigned or default partition offset.

Declaration
public static readonly Offset Unset
Field Value
TypeDescription
Offset

Properties

IsSpecial

Gets whether or not this is one of the special offset values.

Declaration
public bool IsSpecial { get; }
Property Value
TypeDescription
bool

Value

Gets the long value corresponding to this offset.

Declaration
public readonly long Value { get; }
Property Value
TypeDescription
long

Methods

Equals(Offset)

Tests whether this Offset value is equal to the specified Offset.

Declaration
public bool Equals(Offset other)
Parameters
TypeNameDescription
Offsetother

The offset to test.

Returns
TypeDescription
bool

true if other has the same value. false otherwise.

Equals(object)

Tests whether this Offset value is equal to the specified object.

Declaration
public override bool Equals(object obj)
Parameters
TypeNameDescription
objectobj

The object to test.

Returns
TypeDescription
bool

true if obj is an Offset and has the same value. false otherwise.

Overrides
ValueType.Equals(object)

GetHashCode()

Returns a hash code for this Offset.

Declaration
public override int GetHashCode()
Returns
TypeDescription
int

An integer that specifies a hash value for this Offset.

Overrides
ValueType.GetHashCode()

ToString()

Returns a string representation of the Offset object.

Declaration
public override string ToString()
Returns
TypeDescription
string

A string that represents the Offset object.

Overrides
ValueType.ToString()

Operators

operator +(Offset, int)

Add an integer value to an Offset value.

Declaration
public static Offset operator +(Offset a, int b)
Parameters
TypeNameDescription
Offseta

The Offset value to add the integer value to.

intb

The integer value to add to the Offset value.

Returns
TypeDescription
Offset

The Offset value incremented by the integer value b.

operator +(Offset, long)

Add a long value to an Offset value.

Declaration
public static Offset operator +(Offset a, long b)
Parameters
TypeNameDescription
Offseta

The Offset value to add the long value to.

longb

The long value to add to the Offset value.

Returns
TypeDescription
Offset

The Offset value incremented by the long value b.

operator ==(Offset, Offset)

Tests whether Offset value a is equal to Offset value b.

Declaration
public static bool operator ==(Offset a, Offset b)
Parameters
TypeNameDescription
Offseta

The first Offset value to compare.

Offsetb

The second Offset value to compare.

Returns
TypeDescription
bool

true if Offset value a and b are equal. false otherwise.

operator >(Offset, Offset)

Tests whether Offset value a is greater than Offset value b.

Declaration
public static bool operator >(Offset a, Offset b)
Parameters
TypeNameDescription
Offseta

The first Offset value to compare.

Offsetb

The second Offset value to compare.

Returns
TypeDescription
bool

true if Offset value a is greater than Offset value b. false otherwise.

operator >=(Offset, Offset)

Tests whether Offset value a is greater than or equal to Offset value b.

Declaration
public static bool operator >=(Offset a, Offset b)
Parameters
TypeNameDescription
Offseta

The first Offset value to compare.

Offsetb

The second Offset value to compare.

Returns
TypeDescription
bool

true if Offset value a is greater than or equal to Offset value b. false otherwise.

implicit operator long(Offset)

Converts the specified Offset value to a long value.

Declaration
public static implicit operator long(Offset o)
Parameters
TypeNameDescription
Offseto

The Offset value to convert.

Returns
TypeDescription
long

implicit operator Offset(long)

Converts the specified long value to an Offset value.

Declaration
public static implicit operator Offset(long v)
Parameters
TypeNameDescription
longv

The long value to convert.

Returns
TypeDescription
Offset

operator !=(Offset, Offset)

Tests whether Offset value a is not equal to Offset value b.

Declaration
public static bool operator !=(Offset a, Offset b)
Parameters
TypeNameDescription
Offseta

The first Offset value to compare.

Offsetb

The second Offset value to compare.

Returns
TypeDescription
bool

true if Offset value a and b are not equal. false otherwise.

operator <(Offset, Offset)

Tests whether Offset value a is less than Offset value b.

Declaration
public static bool operator <(Offset a, Offset b)
Parameters
TypeNameDescription
Offseta

The first Offset value to compare.

Offsetb

The second Offset value to compare.

Returns
TypeDescription
bool

true if Offset value a is less than Offset value b. false otherwise.

operator <=(Offset, Offset)

Tests whether Offset value a is less than or equal to Offset value b.

Declaration
public static bool operator <=(Offset a, Offset b)
Parameters
TypeNameDescription
Offseta

The first Offset value to compare.

Offsetb

The second Offset value to compare.

Returns
TypeDescription
bool

true if Offset value a is less than or equal to Offset value b. false otherwise.

Implements

IEquatable<T>
In this article