Struct Offset
Represents a Kafka partition offset value.
Implements
Inherited Members
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
Type | Name | Description |
---|---|---|
long | offset | The offset value |
Fields
Beginning
A special value that refers to the beginning of a partition.
Declaration
public static readonly Offset Beginning
Field Value
Type | Description |
---|---|
Offset |
End
A special value that refers to the end of a partition.
Declaration
public static readonly Offset End
Field Value
Type | Description |
---|---|
Offset |
Stored
A special value that refers to the stored offset for a partition.
Declaration
public static readonly Offset Stored
Field Value
Type | Description |
---|---|
Offset |
Unset
A special value that refers to an invalid, unassigned or default partition offset.
Declaration
public static readonly Offset Unset
Field Value
Type | Description |
---|---|
Offset |
Properties
IsSpecial
Gets whether or not this is one of the special offset values.
Declaration
public bool IsSpecial { get; }
Property Value
Type | Description |
---|---|
bool |
Value
Gets the long value corresponding to this offset.
Declaration
public readonly long Value { get; }
Property Value
Type | Description |
---|---|
long |
Methods
Equals(Offset)
Tests whether this Offset value is equal to the specified Offset.
Declaration
public bool Equals(Offset other)
Parameters
Type | Name | Description |
---|---|---|
Offset | other | The offset to test. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
object | obj | The object to test. |
Returns
Type | Description |
---|---|
bool | true if obj is an Offset and has the same value. false otherwise. |
Overrides
GetHashCode()
Returns a hash code for this Offset.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | An integer that specifies a hash value for this Offset. |
Overrides
ToString()
Returns a string representation of the Offset object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the Offset object. |
Overrides
Operators
operator +(Offset, int)
Add an integer value to an Offset value.
Declaration
public static Offset operator +(Offset a, int b)
Parameters
Type | Name | Description |
---|---|---|
Offset | a | The Offset value to add the integer value to. |
int | b | The integer value to add to the Offset value. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The Offset value to add the long value to. |
long | b | The long value to add to the Offset value. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The first Offset value to compare. |
Offset | b | The second Offset value to compare. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The first Offset value to compare. |
Offset | b | The second Offset value to compare. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The first Offset value to compare. |
Offset | b | The second Offset value to compare. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | o | The Offset value to convert. |
Returns
Type | Description |
---|---|
long |
implicit operator Offset(long)
Converts the specified long value to an Offset value.
Declaration
public static implicit operator Offset(long v)
Parameters
Type | Name | Description |
---|---|---|
long | v | The long value to convert. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The first Offset value to compare. |
Offset | b | The second Offset value to compare. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The first Offset value to compare. |
Offset | b | The second Offset value to compare. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Offset | a | The first Offset value to compare. |
Offset | b | The second Offset value to compare. |
Returns
Type | Description |
---|---|
bool | true if Offset value a is less than or equal to Offset value b. false otherwise. |