Class TopicStatsClientImpl
- java.lang.Object
-
- com.google.cloud.pubsublite.internal.ApiResourceAggregation
-
- com.google.cloud.pubsublite.internal.TopicStatsClientImpl
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,ApiBackgroundResource
,TopicStatsClient
,AutoCloseable
public class TopicStatsClientImpl extends ApiResourceAggregation implements TopicStatsClient
-
-
Constructor Summary
Constructors Constructor Description TopicStatsClientImpl(CloudRegion region, TopicStatsServiceClient serviceClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.api.core.ApiFuture<Optional<Cursor>>
computeCursorForEventTime(TopicPath path, Partition partition, com.google.protobuf.Timestamp eventTime)
Compute the cursor of the first message with event time greater than or equal to the specified event time, for a topic partition.com.google.api.core.ApiFuture<Optional<Cursor>>
computeCursorForPublishTime(TopicPath path, Partition partition, com.google.protobuf.Timestamp publishTime)
Compute the cursor of the first message with publish time greater than or equal to the specified publish time, for a topic partition.com.google.api.core.ApiFuture<Cursor>
computeHeadCursor(TopicPath path, Partition partition)
Compute the head cursor for the partition.com.google.api.core.ApiFuture<ComputeMessageStatsResponse>
computeMessageStats(TopicPath path, Partition partition, Offset start, Offset end)
Compute statistics about the messages between two cursors in a topic partition.CloudRegion
region()
The Google Cloud region this client operates on.-
Methods inherited from class com.google.cloud.pubsublite.internal.ApiResourceAggregation
awaitTermination, close, isShutdown, isTerminated, shutdown, shutdownNow
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.pubsublite.internal.ApiBackgroundResource
close
-
-
-
-
Constructor Detail
-
TopicStatsClientImpl
public TopicStatsClientImpl(CloudRegion region, TopicStatsServiceClient serviceClient)
-
-
Method Detail
-
region
public CloudRegion region()
Description copied from interface:TopicStatsClient
The Google Cloud region this client operates on.- Specified by:
region
in interfaceTopicStatsClient
-
computeMessageStats
public com.google.api.core.ApiFuture<ComputeMessageStatsResponse> computeMessageStats(TopicPath path, Partition partition, Offset start, Offset end)
Description copied from interface:TopicStatsClient
Compute statistics about the messages between two cursors in a topic partition.- Specified by:
computeMessageStats
in interfaceTopicStatsClient
- Parameters:
path
- The topic to compute statistics onpartition
- The partition to compute statistics forstart
- The start cursorend
- The end cursor- Returns:
- A future that will have either an error
ApiException
or the ComputeMessageStatistics on success.
-
computeHeadCursor
public com.google.api.core.ApiFuture<Cursor> computeHeadCursor(TopicPath path, Partition partition)
Description copied from interface:TopicStatsClient
Compute the head cursor for the partition. The head cursor's offset is guaranteed to be before or equal to all messages which have not yet been acknowledged to be published, and greater than the offset of any message whose publish has already been acknowledged. It is 0 if there have never been messages on the partition.- Specified by:
computeHeadCursor
in interfaceTopicStatsClient
- Parameters:
path
- The topic to compute head cursor onpartition
- The partition to compute head cursor for- Returns:
- A future that will have either an error
ApiException
or the head cursor on success.
-
computeCursorForPublishTime
public com.google.api.core.ApiFuture<Optional<Cursor>> computeCursorForPublishTime(TopicPath path, Partition partition, com.google.protobuf.Timestamp publishTime)
Description copied from interface:TopicStatsClient
Compute the cursor of the first message with publish time greater than or equal to the specified publish time, for a topic partition. All messages thereafter are guaranteed to have publish times greater than or equal to the specified publish time.If such a message cannot be found, the returned Optional will be empty.
- Specified by:
computeCursorForPublishTime
in interfaceTopicStatsClient
- Parameters:
path
- The topic to compute cursor forpartition
- The partition to compute cursor forpublishTime
- The target publish time- Returns:
- A future that will have either an error
ApiException
, an empty Optional or a non-nullCursor
.
-
computeCursorForEventTime
public com.google.api.core.ApiFuture<Optional<Cursor>> computeCursorForEventTime(TopicPath path, Partition partition, com.google.protobuf.Timestamp eventTime)
Description copied from interface:TopicStatsClient
Compute the cursor of the first message with event time greater than or equal to the specified event time, for a topic partition. If messages are missing an event time, the publish time is used as a fallback. As event times are user supplied, subsequent messages may have event times less than the specified event time and should be filtered by the client, if necessary.If such a message cannot be found, the returned Optional will be empty.
- Specified by:
computeCursorForEventTime
in interfaceTopicStatsClient
- Parameters:
path
- The topic to compute cursor forpartition
- The partition to compute cursor foreventTime
- The target event time- Returns:
- A future that will have either an error
ApiException
, an empty Optional or a non-nullCursor
.
-
-