| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | |
|
| | 6 | | namespace Azure.Messaging.EventHubs |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// A set of information for a single partition of an Event Hub. |
| | 10 | | /// </summary> |
| | 11 | | /// |
| | 12 | | public class PartitionProperties |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// The name of the Event Hub where the partitions reside, specific to the |
| | 16 | | /// Event Hubs namespace that contains it. |
| | 17 | | /// </summary> |
| | 18 | | /// |
| 2 | 19 | | public string EventHubName { get; } |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// The identifier of the partition, unique to the Event Hub which contains it. |
| | 23 | | /// </summary> |
| | 24 | | /// |
| 2 | 25 | | public string Id { get; } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// The first sequence number available for events in the partition. |
| | 29 | | /// </summary> |
| | 30 | | /// |
| 2 | 31 | | public long BeginningSequenceNumber { get; } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// The sequence number of the last observed event to be enqueued in the partition. |
| | 35 | | /// </summary> |
| | 36 | | /// |
| 2 | 37 | | public long LastEnqueuedSequenceNumber { get; } |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// The offset of the last observed event to be enqueued in the partition. |
| | 41 | | /// </summary> |
| | 42 | | /// |
| 2 | 43 | | public long LastEnqueuedOffset { get; } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// The date and time, in UTC, that the last observed event was enqueued in the partition. |
| | 47 | | /// </summary> |
| | 48 | | /// |
| 2 | 49 | | public DateTimeOffset LastEnqueuedTime { get; } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// Indicates whether or not the partition is currently empty. |
| | 53 | | /// </summary> |
| | 54 | | /// |
| | 55 | | /// <value><c>true</c> if the partition is empty; otherwise, <c>false</c>.</value> |
| | 56 | | /// |
| 2 | 57 | | public bool IsEmpty { get; } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Initializes a new instance of the <see cref="PartitionProperties"/> class. |
| | 61 | | /// </summary> |
| | 62 | | /// |
| | 63 | | /// <param name="eventHubName">The name of the Event Hub that contains the partitions.</param> |
| | 64 | | /// <param name="partitionId">The identifier of the partition.</param> |
| | 65 | | /// <param name="isEmpty">Indicates whether or not the partition is currently empty.</param> |
| | 66 | | /// <param name="beginningSequenceNumber">The first sequence number available for events in the partition.</para |
| | 67 | | /// <param name="lastSequenceNumber">The sequence number observed the last event to be enqueued in the partition |
| | 68 | | /// <param name="lastOffset">The offset of the last event to be enqueued in the partition.</param> |
| | 69 | | /// <param name="lastEnqueuedTime">The date and time, in UTC, that the last event was enqueued in the partition. |
| | 70 | | /// |
| 2 | 71 | | protected internal PartitionProperties(string eventHubName, |
| 2 | 72 | | string partitionId, |
| 2 | 73 | | bool isEmpty, |
| 2 | 74 | | long beginningSequenceNumber, |
| 2 | 75 | | long lastSequenceNumber, |
| 2 | 76 | | long lastOffset, |
| 2 | 77 | | DateTimeOffset lastEnqueuedTime) |
| | 78 | | { |
| 2 | 79 | | EventHubName = eventHubName; |
| 2 | 80 | | Id = partitionId; |
| 2 | 81 | | BeginningSequenceNumber = beginningSequenceNumber; |
| 2 | 82 | | LastEnqueuedSequenceNumber = lastSequenceNumber; |
| 2 | 83 | | LastEnqueuedOffset = lastOffset; |
| 2 | 84 | | LastEnqueuedTime = lastEnqueuedTime; |
| 2 | 85 | | IsEmpty = isEmpty; |
| 2 | 86 | | } |
| | 87 | | } |
| | 88 | | } |