@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121import "google/api/field_behavior.proto" ;
2222import "google/api/resource.proto" ;
2323import "google/cloud/pubsublite/v1/common.proto" ;
24+ import "google/longrunning/operations.proto" ;
2425import "google/protobuf/empty.proto" ;
2526import "google/protobuf/field_mask.proto" ;
2627import "google/protobuf/timestamp.proto" ;
@@ -139,6 +140,38 @@ service AdminService {
139140 option (google.api.method_signature ) = "name" ;
140141 }
141142
143+ // Performs an out-of-band seek for a subscription to a specified target,
144+ // which may be timestamps or named positions within the message backlog.
145+ // Seek translates these targets to cursors for each partition and
146+ // orchestrates subscribers to start consuming messages from these seek
147+ // cursors.
148+ //
149+ // If an operation is returned, the seek has been registered and subscribers
150+ // will eventually receive messages from the seek cursors (i.e. eventual
151+ // consistency), as long as they are using a minimum supported client library
152+ // version and not a system that tracks cursors independently of Pub/Sub Lite
153+ // (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for
154+ // unsupported clients.
155+ //
156+ // If clients would like to know when subscribers react to the seek (or not),
157+ // they can poll the operation. The seek operation will succeed and complete
158+ // once subscribers are ready to receive messages from the seek cursors for
159+ // all partitions of the topic. This means that the seek operation will not
160+ // complete until all subscribers come online.
161+ //
162+ // If the previous seek operation has not yet completed, it will be aborted
163+ // and the new invocation of seek will supersede it.
164+ rpc SeekSubscription (SeekSubscriptionRequest ) returns (google.longrunning.Operation ) {
165+ option (google.api.http ) = {
166+ post : "/v1/admin/{name=projects/*/locations/*/subscriptions/*}:seek"
167+ body : "*"
168+ };
169+ option (google.longrunning.operation_info ) = {
170+ response_type : "SeekSubscriptionResponse"
171+ metadata_type : "OperationMetadata"
172+ };
173+ }
174+
142175 // Creates a new reservation.
143176 rpc CreateReservation (CreateReservationRequest ) returns (Reservation ) {
144177 option (google.api.http ) = {
@@ -421,6 +454,64 @@ message DeleteSubscriptionRequest {
421454 ];
422455}
423456
457+ // Request for SeekSubscription.
458+ message SeekSubscriptionRequest {
459+ // A named position with respect to the message backlog.
460+ enum NamedTarget {
461+ // Unspecified named target. Do not use.
462+ NAMED_TARGET_UNSPECIFIED = 0 ;
463+
464+ // Seek to the oldest retained message.
465+ TAIL = 1 ;
466+
467+ // Seek past all recently published messages, skipping the entire message
468+ // backlog.
469+ HEAD = 2 ;
470+ }
471+
472+ // Required. The name of the subscription to seek.
473+ string name = 1 [
474+ (google.api.field_behavior ) = REQUIRED ,
475+ (google.api.resource_reference ) = {
476+ type : "pubsublite.googleapis.com/Subscription"
477+ }
478+ ];
479+
480+ // The target to seek to. Must be set.
481+ oneof target {
482+ // Seek to a named position with respect to the message backlog.
483+ NamedTarget named_target = 2 ;
484+
485+ // Seek to the first message whose publish or event time is greater than or
486+ // equal to the specified query time. If no such message can be located,
487+ // will seek to the end of the message backlog.
488+ TimeTarget time_target = 3 ;
489+ }
490+ }
491+
492+ // Response for SeekSubscription long running operation.
493+ message SeekSubscriptionResponse {
494+
495+ }
496+
497+ // Metadata for long running operations.
498+ message OperationMetadata {
499+ // The time the operation was created.
500+ google.protobuf.Timestamp create_time = 1 ;
501+
502+ // The time the operation finished running. Not set if the operation has not
503+ // completed.
504+ google.protobuf.Timestamp end_time = 2 ;
505+
506+ // Resource path for the target of the operation. For example, targets of
507+ // seeks are subscription resources, structured like:
508+ // projects/{project_number}/locations/{location}/subscriptions/{subscription_id}
509+ string target = 3 ;
510+
511+ // Name of the verb executed by the operation.
512+ string verb = 4 ;
513+ }
514+
424515// Request for CreateReservation.
425516message CreateReservationRequest {
426517 // Required. The parent location in which to create the reservation.
0 commit comments