MCPcopy Create free account
hub / github.com/google/go-cloud / createTopic

Function createTopic

pubsub/gcppubsub/gcppubsub_test.go:81–91  ·  view source on GitHub ↗
(ctx context.Context, pubClient *raw.PublisherClient, topicName, topicPath string)

Source from the content-addressed store, hash-verified

79}
80
81func createTopic(ctx context.Context, pubClient *raw.PublisherClient, topicName, topicPath string) (dt driver.Topic, cleanup func(), err error) {
82 _, err = pubClient.CreateTopic(ctx, &pubsubpb.Topic{Name: topicPath})
83 if err != nil {
84 return nil, nil, err
85 }
86 dt = openTopic(pubClient, path.Join("projects", projectID, "topics", topicName))
87 cleanup = func() {
88 pubClient.DeleteTopic(ctx, &pubsubpb.DeleteTopicRequest{Topic: topicPath})
89 }
90 return dt, cleanup, nil
91}
92
93func (h *harness) MakeNonexistentTopic(ctx context.Context) (driver.Topic, error) {
94 return openTopic(h.pubClient, path.Join("projects", projectID, "topics", "nonexistent-topic")), nil

Callers 2

CreateTopicMethod · 0.70
BenchmarkGcpPubSubFunction · 0.70

Calls 2

openTopicFunction · 0.70
CreateTopicMethod · 0.65

Tested by

no test coverage detected