Pub/Sub Lite API v1 - Package cloud.google.com/go/pubsublite/apiv1 (v0.5.0)

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit pkg.go.dev/cloud.google.com/go.

Functions

func DefaultAuthScopes

  func 
  
 DefaultAuthScopes 
 () 
  
 [] 
  string 
 
 

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

AdminCallOptions

  type 
  
 AdminCallOptions 
  
 struct 
  
 { 
  
 CreateTopic 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetTopic 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetTopicPartitions 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListTopics 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdateTopic 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeleteTopic 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListTopicSubscriptions 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 CreateSubscription 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetSubscription 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListSubscriptions 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdateSubscription 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeleteSubscription 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

AdminCallOptions contains the retry settings for each method of AdminClient.

AdminClient

  type 
  
 AdminClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  AdminCallOptions 
 
  
 // contains filtered or unexported fields 
 } 
 

AdminClient is a client for interacting with .

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewAdminClient

  func 
  
 NewAdminClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  AdminClient 
 
 , 
  
  error 
 
 ) 
 

NewAdminClient creates a new admin service client.

The service that a client application uses to manage topics and subscriptions, such creating, listing, and deleting topics and subscriptions.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*AdminClient) Close

  func 
  
 ( 
 c 
  
 * 
  AdminClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*AdminClient) Connection

  func 
  
 ( 
 c 
  
 * 
  AdminClient 
 
 ) 
  
 Connection 
 () 
  
 * 
  grpc 
 
 . 
  ClientConn 
 
 

Connection returns a connection to the API service.

Deprecated.

func (*AdminClient) CreateSubscription

CreateSubscription creates a new subscription.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  CreateSubscriptionRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CreateSubscription 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*AdminClient) CreateTopic

CreateTopic creates a new topic.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  CreateTopicRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CreateTopic 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*AdminClient) DeleteSubscription

DeleteSubscription deletes the specified subscription.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  DeleteSubscriptionRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 err 
  
 = 
  
 c 
 . 
 DeleteSubscription 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
 } 
 

func (*AdminClient) DeleteTopic

DeleteTopic deletes the specified topic.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  DeleteTopicRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 err 
  
 = 
  
 c 
 . 
 DeleteTopic 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
 } 
 

func (*AdminClient) GetSubscription

GetSubscription returns the subscription configuration.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  GetSubscriptionRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetSubscription 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*AdminClient) GetTopic

GetTopic returns the topic configuration.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  GetTopicRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetTopic 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*AdminClient) GetTopicPartitions

GetTopicPartitions returns the partition information for the requested topic.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  GetTopicPartitionsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetTopicPartitions 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*AdminClient) ListSubscriptions

ListSubscriptions returns the list of subscriptions for the given project.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 "google.golang.org/api/iterator" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 // import "google.golang.org/api/iterator" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  ListSubscriptionsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListSubscriptions 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
  Done 
 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*AdminClient) ListTopicSubscriptions

ListTopicSubscriptions lists the subscriptions attached to the specified topic.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 "google.golang.org/api/iterator" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 // import "google.golang.org/api/iterator" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  ListTopicSubscriptionsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListTopicSubscriptions 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
  Done 
 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*AdminClient) ListTopics

ListTopics returns the list of topics for the given project.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 "google.golang.org/api/iterator" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 // import "google.golang.org/api/iterator" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  ListTopicsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListTopics 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
  Done 
 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*AdminClient) UpdateSubscription

UpdateSubscription updates properties of the specified subscription.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  UpdateSubscriptionRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdateSubscription 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*AdminClient) UpdateTopic

UpdateTopic updates properties of the specified topic.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewAdminClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  UpdateTopicRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdateTopic 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

CursorCallOptions

  type 
  
 CursorCallOptions 
  
 struct 
  
 { 
  
 StreamingCommitCursor 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 CommitCursor 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListPartitionCursors 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

CursorCallOptions contains the retry settings for each method of CursorClient.

CursorClient

  type 
  
 CursorClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  CursorCallOptions 
 
  
 // contains filtered or unexported fields 
 } 
 

CursorClient is a client for interacting with .

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewCursorClient

  func 
  
 NewCursorClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  CursorClient 
 
 , 
  
  error 
 
 ) 
 

NewCursorClient creates a new cursor service client.

The service that a subscriber client application uses to manage committed cursors while receiving messsages. A cursor represents a subscriber’s progress within a topic partition for a given subscription.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewCursorClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*CursorClient) Close

  func 
  
 ( 
 c 
  
 * 
  CursorClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*CursorClient) CommitCursor

CommitCursor updates the committed cursor.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewCursorClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  CommitCursorRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CommitCursor 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*CursorClient) Connection

  func 
  
 ( 
 c 
  
 * 
  CursorClient 
 
 ) 
  
 Connection 
 () 
  
 * 
  grpc 
 
 . 
  ClientConn 
 
 

Connection returns a connection to the API service.

Deprecated.

func (*CursorClient) ListPartitionCursors

ListPartitionCursors returns all committed cursor information for a subscription.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 "google.golang.org/api/iterator" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 // import "google.golang.org/api/iterator" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewCursorClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  ListPartitionCursorsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListPartitionCursors 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
  Done 
 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*CursorClient) StreamingCommitCursor

StreamingCommitCursor establishes a stream with the server for managing committed cursors.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 "io" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewCursorClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 stream 
 , 
  
 err 
  
 := 
  
 c 
 . 
 StreamingCommitCursor 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 go 
  
 func 
 () 
  
 { 
  
 reqs 
  
 := 
  
 [] 
 * 
 pubsublitepb 
 . 
  StreamingCommitCursorRequest 
 
 { 
  
 // TODO: Create requests. 
  
 } 
  
 for 
  
 _ 
 , 
  
 req 
  
 := 
  
 range 
  
 reqs 
  
 { 
  
 if 
  
 err 
  
 := 
  
 stream 
 . 
 Send 
 ( 
 req 
 ); 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 } 
  
 stream 
 . 
 CloseSend 
 () 
  
 }() 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 stream 
 . 
 Recv 
 () 
  
 if 
  
 err 
  
 == 
  
 io 
 . 
 EOF 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

PartitionAssignmentCallOptions

  type 
  
 PartitionAssignmentCallOptions 
  
 struct 
  
 { 
  
 AssignPartitions 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

PartitionAssignmentCallOptions contains the retry settings for each method of PartitionAssignmentClient.

PartitionAssignmentClient

  type 
  
 PartitionAssignmentClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  PartitionAssignmentCallOptions 
 
  
 // contains filtered or unexported fields 
 } 
 

PartitionAssignmentClient is a client for interacting with .

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewPartitionAssignmentClient

  func 
  
 NewPartitionAssignmentClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  PartitionAssignmentClient 
 
 , 
  
  error 
 
 ) 
 

NewPartitionAssignmentClient creates a new partition assignment service client.

The service that a subscriber client application uses to determine which partitions it should connect to.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewPartitionAssignmentClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*PartitionAssignmentClient) AssignPartitions

AssignPartitions assign partitions for this client to handle for the specified subscription.

The client must send an InitialPartitionAssignmentRequest first. The server will then send at most one unacknowledged PartitionAssignment outstanding on the stream at a time. The client should send a PartitionAssignmentAck after updating the partitions it is connected to to reflect the new assignment.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 "io" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewPartitionAssignmentClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 stream 
 , 
  
 err 
  
 := 
  
 c 
 . 
 AssignPartitions 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 go 
  
 func 
 () 
  
 { 
  
 reqs 
  
 := 
  
 [] 
 * 
 pubsublitepb 
 . 
  PartitionAssignmentRequest 
 
 { 
  
 // TODO: Create requests. 
  
 } 
  
 for 
  
 _ 
 , 
  
 req 
  
 := 
  
 range 
  
 reqs 
  
 { 
  
 if 
  
 err 
  
 := 
  
 stream 
 . 
 Send 
 ( 
 req 
 ); 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 } 
  
 stream 
 . 
 CloseSend 
 () 
  
 }() 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 stream 
 . 
 Recv 
 () 
  
 if 
  
 err 
  
 == 
  
 io 
 . 
 EOF 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*PartitionAssignmentClient) Close

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*PartitionAssignmentClient) Connection

Connection returns a connection to the API service.

Deprecated.

PartitionCursorIterator

  type 
  
 PartitionCursorIterator 
  
 struct 
  
 { 
  
 // Response is the raw response for the current page. 
  
 // It must be cast to the RPC response type. 
  
 // Calling Next() or InternalFetch() updates this value. 
  
 Response 
  
 interface 
 {} 
  
 // InternalFetch is for use by the Google Cloud Libraries only. 
  
 // It is not part of the stable interface of this package. 
  
 // 
  
 // InternalFetch returns results from a single call to the underlying RPC. 
  
 // The number of results is no greater than pageSize. 
  
 // If there are no more results, nextPageToken is empty and err is nil. 
  
 InternalFetch 
  
 func 
 ( 
 pageSize 
  
  int 
 
 , 
  
 pageToken 
  
  string 
 
 ) 
  
 ( 
 results 
  
 [] 
 * 
  pubsublitepb 
 
 . 
  PartitionCursor 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

PartitionCursorIterator manages a stream of *pubsublitepb.PartitionCursor.

func (*PartitionCursorIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*PartitionCursorIterator) PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

PublisherCallOptions

  type 
  
 PublisherCallOptions 
  
 struct 
  
 { 
  
 Publish 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

PublisherCallOptions contains the retry settings for each method of PublisherClient.

PublisherClient

  type 
  
 PublisherClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  PublisherCallOptions 
 
  
 // contains filtered or unexported fields 
 } 
 

PublisherClient is a client for interacting with .

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewPublisherClient

  func 
  
 NewPublisherClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  PublisherClient 
 
 , 
  
  error 
 
 ) 
 

NewPublisherClient creates a new publisher service client.

The service that a publisher client application uses to publish messages to topics. Published messages are retained by the service for the duration of the retention period configured for the respective topic, and are delivered to subscriber clients upon request (via the SubscriberService).

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewPublisherClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*PublisherClient) Close

  func 
  
 ( 
 c 
  
 * 
  PublisherClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*PublisherClient) Connection

  func 
  
 ( 
 c 
  
 * 
  PublisherClient 
 
 ) 
  
 Connection 
 () 
  
 * 
  grpc 
 
 . 
  ClientConn 
 
 

Connection returns a connection to the API service.

Deprecated.

func (*PublisherClient) Publish

Publish establishes a stream with the server for publishing messages. Once the stream is initialized, the client publishes messages by sending publish requests on the stream. The server responds with a PublishResponse for each PublishRequest sent by the client, in the same order that the requests were sent. Note that multiple PublishRequests can be in flight simultaneously, but they will be processed by the server in the order that they are sent by the client on a given stream.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 "io" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewPublisherClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 stream 
 , 
  
 err 
  
 := 
  
 c 
 . 
 Publish 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 go 
  
 func 
 () 
  
 { 
  
 reqs 
  
 := 
  
 [] 
 * 
 pubsublitepb 
 . 
  PublishRequest 
 
 { 
  
 // TODO: Create requests. 
  
 } 
  
 for 
  
 _ 
 , 
  
 req 
  
 := 
  
 range 
  
 reqs 
  
 { 
  
 if 
  
 err 
  
 := 
  
 stream 
 . 
 Send 
 ( 
 req 
 ); 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 } 
  
 stream 
 . 
 CloseSend 
 () 
  
 }() 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 stream 
 . 
 Recv 
 () 
  
 if 
  
 err 
  
 == 
  
 io 
 . 
 EOF 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

StringIterator

  type 
  
 StringIterator 
  
 struct 
  
 { 
  
 // Response is the raw response for the current page. 
  
 // It must be cast to the RPC response type. 
  
 // Calling Next() or InternalFetch() updates this value. 
  
 Response 
  
 interface 
 {} 
  
 // InternalFetch is for use by the Google Cloud Libraries only. 
  
 // It is not part of the stable interface of this package. 
  
 // 
  
 // InternalFetch returns results from a single call to the underlying RPC. 
  
 // The number of results is no greater than pageSize. 
  
 // If there are no more results, nextPageToken is empty and err is nil. 
  
 InternalFetch 
  
 func 
 ( 
 pageSize 
  
  int 
 
 , 
  
 pageToken 
  
  string 
 
 ) 
  
 ( 
 results 
  
 [] 
  string 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

StringIterator manages a stream of string.

func (*StringIterator) Next

  func 
  
 ( 
 it 
  
 * 
  StringIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
  string 
 
 , 
  
  error 
 
 ) 
 

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*StringIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  StringIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
  iterator 
 
 . 
  PageInfo 
 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

SubscriberCallOptions

  type 
  
 SubscriberCallOptions 
  
 struct 
  
 { 
  
 Subscribe 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

SubscriberCallOptions contains the retry settings for each method of SubscriberClient.

SubscriberClient

  type 
  
 SubscriberClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  SubscriberCallOptions 
 
  
 // contains filtered or unexported fields 
 } 
 

SubscriberClient is a client for interacting with .

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewSubscriberClient

  func 
  
 NewSubscriberClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  SubscriberClient 
 
 , 
  
  error 
 
 ) 
 

NewSubscriberClient creates a new subscriber service client.

The service that a subscriber client application uses to receive messages from subscriptions.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewSubscriberClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*SubscriberClient) Close

  func 
  
 ( 
 c 
  
 * 
  SubscriberClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*SubscriberClient) Connection

  func 
  
 ( 
 c 
  
 * 
  SubscriberClient 
 
 ) 
  
 Connection 
 () 
  
 * 
  grpc 
 
 . 
  ClientConn 
 
 

Connection returns a connection to the API service.

Deprecated.

func (*SubscriberClient) Subscribe

Subscribe establishes a stream with the server for receiving messages.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 "io" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewSubscriberClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 stream 
 , 
  
 err 
  
 := 
  
 c 
 . 
 Subscribe 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 go 
  
 func 
 () 
  
 { 
  
 reqs 
  
 := 
  
 [] 
 * 
 pubsublitepb 
 . 
  SubscribeRequest 
 
 { 
  
 // TODO: Create requests. 
  
 } 
  
 for 
  
 _ 
 , 
  
 req 
  
 := 
  
 range 
  
 reqs 
  
 { 
  
 if 
  
 err 
  
 := 
  
 stream 
 . 
 Send 
 ( 
 req 
 ); 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 } 
  
 stream 
 . 
 CloseSend 
 () 
  
 }() 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 stream 
 . 
 Recv 
 () 
  
 if 
  
 err 
  
 == 
  
 io 
 . 
 EOF 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

SubscriptionIterator

  type 
  
 SubscriptionIterator 
  
 struct 
  
 { 
  
 // Response is the raw response for the current page. 
  
 // It must be cast to the RPC response type. 
  
 // Calling Next() or InternalFetch() updates this value. 
  
 Response 
  
 interface 
 {} 
  
 // InternalFetch is for use by the Google Cloud Libraries only. 
  
 // It is not part of the stable interface of this package. 
  
 // 
  
 // InternalFetch returns results from a single call to the underlying RPC. 
  
 // The number of results is no greater than pageSize. 
  
 // If there are no more results, nextPageToken is empty and err is nil. 
  
 InternalFetch 
  
 func 
 ( 
 pageSize 
  
  int 
 
 , 
  
 pageToken 
  
  string 
 
 ) 
  
 ( 
 results 
  
 [] 
 * 
  pubsublitepb 
 
 . 
  Subscription 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

SubscriptionIterator manages a stream of *pubsublitepb.Subscription.

func (*SubscriptionIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*SubscriptionIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  SubscriptionIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
  iterator 
 
 . 
  PageInfo 
 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

TopicIterator

  type 
  
 TopicIterator 
  
 struct 
  
 { 
  
 // Response is the raw response for the current page. 
  
 // It must be cast to the RPC response type. 
  
 // Calling Next() or InternalFetch() updates this value. 
  
 Response 
  
 interface 
 {} 
  
 // InternalFetch is for use by the Google Cloud Libraries only. 
  
 // It is not part of the stable interface of this package. 
  
 // 
  
 // InternalFetch returns results from a single call to the underlying RPC. 
  
 // The number of results is no greater than pageSize. 
  
 // If there are no more results, nextPageToken is empty and err is nil. 
  
 InternalFetch 
  
 func 
 ( 
 pageSize 
  
  int 
 
 , 
  
 pageToken 
  
  string 
 
 ) 
  
 ( 
 results 
  
 [] 
 * 
  pubsublitepb 
 
 . 
  Topic 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

TopicIterator manages a stream of *pubsublitepb.Topic.

func (*TopicIterator) Next

  func 
  
 ( 
 it 
  
 * 
  TopicIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  pubsublitepb 
 
 . 
  Topic 
 
 , 
  
  error 
 
 ) 
 

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*TopicIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  TopicIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
  iterator 
 
 . 
  PageInfo 
 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

TopicStatsCallOptions

  type 
  
 TopicStatsCallOptions 
  
 struct 
  
 { 
  
 ComputeMessageStats 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ComputeHeadCursor 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

TopicStatsCallOptions contains the retry settings for each method of TopicStatsClient.

TopicStatsClient

  type 
  
 TopicStatsClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  TopicStatsCallOptions 
 
  
 // contains filtered or unexported fields 
 } 
 

TopicStatsClient is a client for interacting with .

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewTopicStatsClient

  func 
  
 NewTopicStatsClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  TopicStatsClient 
 
 , 
  
  error 
 
 ) 
 

NewTopicStatsClient creates a new topic stats service client.

This service allows users to get stats about messages in their topic.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewTopicStatsClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*TopicStatsClient) Close

  func 
  
 ( 
 c 
  
 * 
  TopicStatsClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*TopicStatsClient) ComputeHeadCursor

ComputeHeadCursor 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.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewTopicStatsClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  ComputeHeadCursorRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 ComputeHeadCursor 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*TopicStatsClient) ComputeMessageStats

ComputeMessageStats compute statistics about a range of messages in a given topic and partition.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 pubsublite 
  
 "cloud.google.com/go/pubsublite/apiv1" 
  
 pubsublitepb 
  
 "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 // import pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 c 
 , 
  
 err 
  
 := 
  
 pubsublite 
 . 
  NewTopicStatsClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 req 
  
 := 
  
& pubsublitepb 
 . 
  ComputeMessageStatsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 ComputeMessageStats 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*TopicStatsClient) Connection

  func 
  
 ( 
 c 
  
 * 
  TopicStatsClient 
 
 ) 
  
 Connection 
 () 
  
 * 
  grpc 
 
 . 
  ClientConn 
 
 

Connection returns a connection to the API service.

Deprecated.

Create a Mobile Website
View Site in Mobile | Classic
Share by: