Search Results for

    Show / Hide Table of Contents

    Class FromEnd

    Corresponds to a relative offset that begins the query at the Count-th event from the end of history (inclusive), e.g. "give me the last 10 events" for a tag or across all events.

    Unlike Sequence and TimeBasedUuid, FromEnd is a query input only: it is never returned in an EventEnvelope. Each EventEnvelope still carries a concrete Sequence offset, so to resume a stream at a later point you use that absolute offset, not a FromEnd value. Because it is relative rather than absolute, FromEnd is not orderable and CompareTo(Offset) always throws.

    The from-the-end position is resolved to a concrete start offset when the query is materialized, by reading how many matching events exist at that moment. For a live query (or any backend that resolves the count and reads the events in separate steps) this is best-effort: events written between resolving the count and reading the first batch may widen the initial window beyond Count.

    Not all read journals support this offset type. Implementations that cannot honor it will throw when it is supplied, the same way they reject any other unsupported offset type.

    Inheritance
    object
    Offset
    FromEnd
    Implements
    IComparable<Offset>
    Inherited Members
    Offset.NoOffset()
    Offset.Sequence(long)
    Offset.TimeBasedUuid(Guid)
    Offset.FromEnd(int)
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Akka.Persistence.Query
    Assembly: Akka.Persistence.Query.dll
    Syntax
    public sealed class FromEnd : Offset, IComparable<Offset>

    Constructors

    | Edit this page View Source

    FromEnd(int)

    Initializes a new instance of the FromEnd class.

    Declaration
    public FromEnd(int count)
    Parameters
    Type Name Description
    int count

    The number of events to read from the end of history. Must be greater than zero.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when count is less than or equal to zero.

    Properties

    | Edit this page View Source

    Count

    The number of events to read from the end of history.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    CompareTo(Offset)

    FromEnd is a relative, input-only offset and has no position in the stream, so it cannot be ordered against any offset (including another FromEnd). Always throws.

    Declaration
    public override int CompareTo(Offset other)
    Parameters
    Type Name Description
    Offset other
    Returns
    Type Description
    int
    Overrides
    Offset.CompareTo(Offset)
    Exceptions
    Type Condition
    InvalidOperationException

    Always thrown.

    | Edit this page View Source

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()
    | Edit this page View Source

    ToString()

    Used to log offset's value

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    Offset.ToString()

    Implements

    IComparable<T>

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET