Export protos for pubsublite.googleapis.com.

PiperOrigin-RevId: 312319867
This commit is contained in:
Google APIs 2020-05-19 11:36:11 -07:00 committed by Copybara-Service
parent cd3ce2651c
commit 247c651475
7 changed files with 1164 additions and 0 deletions

View File

@ -0,0 +1,180 @@
# This file was automatically generated by BuildFileGenerator
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(
name = "pubsublite_proto",
srcs = [
"admin.proto",
"common.proto",
"cursor.proto",
"publisher.proto",
"subscriber.proto",
],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_grpc_library",
"java_proto_library",
)
java_proto_library(
name = "pubsublite_java_proto",
deps = [":pubsublite_proto"],
)
java_grpc_library(
name = "pubsublite_java_grpc",
srcs = [":pubsublite_proto"],
deps = [":pubsublite_java_proto"],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_proto_library",
)
go_proto_library(
name = "pubsublite_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1",
protos = [":pubsublite_proto"],
deps = [
"//google/api:annotations_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"moved_proto_library",
"py_grpc_library",
"py_proto_library",
)
moved_proto_library(
name = "pubsublite_moved_proto",
srcs = [":pubsublite_proto"],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
py_proto_library(
name = "pubsublite_py_proto",
plugin = "@protoc_docs_plugin//:docs_plugin",
deps = [":pubsublite_moved_proto"],
)
py_grpc_library(
name = "pubsublite_py_grpc",
srcs = [":pubsublite_moved_proto"],
deps = [":pubsublite_py_proto"],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "pubsublite_php_proto",
deps = [":pubsublite_proto"],
)
php_grpc_library(
name = "pubsublite_php_grpc",
srcs = [":pubsublite_proto"],
deps = [":pubsublite_php_proto"],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "pubsublite_ruby_proto",
deps = [":pubsublite_proto"],
)
ruby_grpc_library(
name = "pubsublite_ruby_grpc",
srcs = [":pubsublite_proto"],
deps = [":pubsublite_ruby_proto"],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "pubsublite_csharp_proto",
deps = [":pubsublite_proto"],
)
csharp_grpc_library(
name = "pubsublite_csharp_grpc",
srcs = [":pubsublite_proto"],
deps = [":pubsublite_csharp_proto"],
)
##############################################################################
# C++
##############################################################################
# Put your C++ code here

View File

@ -0,0 +1,363 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.pubsublite.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/pubsublite/v1/common.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite";
option java_multiple_files = true;
option java_outer_classname = "AdminProto";
option java_package = "com.google.cloud.pubsublite.proto";
// The service that a client application uses to manage topics and
// subscriptions, such creating, listing, and deleting topics and subscriptions.
service AdminService {
option (google.api.default_host) = "pubsublite.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
// Creates a new topic.
rpc CreateTopic(CreateTopicRequest) returns (Topic) {
option (google.api.http) = {
post: "/v1/admin/{parent=projects/*/locations/*}/topics"
body: "topic"
};
option (google.api.method_signature) = "parent,topic,topic_id";
}
// Returns the topic configuration.
rpc GetTopic(GetTopicRequest) returns (Topic) {
option (google.api.http) = {
get: "/v1/admin/{name=projects/*/locations/*/topics/*}"
};
option (google.api.method_signature) = "name";
}
// Returns the partition information for the requested topic.
rpc GetTopicPartitions(GetTopicPartitionsRequest) returns (TopicPartitions) {
option (google.api.http) = {
get: "/v1/admin/{name=projects/*/locations/*/topics/*}/partitions"
};
option (google.api.method_signature) = "name";
}
// Returns the list of topics for the given project.
rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) {
option (google.api.http) = {
get: "/v1/admin/{parent=projects/*/locations/*}/topics"
};
option (google.api.method_signature) = "parent";
}
// Updates properties of the specified topic.
rpc UpdateTopic(UpdateTopicRequest) returns (Topic) {
option (google.api.http) = {
patch: "/v1/admin/{topic.name=projects/*/locations/*/topics/*}"
body: "topic"
};
option (google.api.method_signature) = "topic,update_mask";
}
// Deletes the specified topic.
rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/admin/{name=projects/*/locations/*/topics/*}"
};
option (google.api.method_signature) = "name";
}
// Lists the subscriptions attached to the specified topic.
rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse) {
option (google.api.http) = {
get: "/v1/admin/{name=projects/*/locations/*/topics/*}/subscriptions"
};
option (google.api.method_signature) = "name";
}
// Creates a new subscription.
rpc CreateSubscription(CreateSubscriptionRequest) returns (Subscription) {
option (google.api.http) = {
post: "/v1/admin/{parent=projects/*/locations/*}/subscriptions"
body: "subscription"
};
option (google.api.method_signature) = "parent,subscription,subscription_id";
}
// Returns the subscription configuration.
rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) {
option (google.api.http) = {
get: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}"
};
option (google.api.method_signature) = "name";
}
// Returns the list of subscriptions for the given project.
rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse) {
option (google.api.http) = {
get: "/v1/admin/{parent=projects/*/locations/*}/subscriptions"
};
option (google.api.method_signature) = "parent";
}
// Updates properties of the specified subscription.
rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) {
option (google.api.http) = {
patch: "/v1/admin/{subscription.name=projects/*/locations/*/subscriptions/*}"
body: "subscription"
};
option (google.api.method_signature) = "subscription,update_mask";
}
// Deletes the specified subscription.
rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}"
};
option (google.api.method_signature) = "name";
}
}
// Request for CreateTopic.
message CreateTopicRequest {
// Required. The parent location in which to create the topic.
// Structured like `projects/{project_number}/locations/{location}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// Required. Configuration of the topic to create. Its `name` field is ignored.
Topic topic = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The ID to use for the topic, which will become the final component of
// the topic's name.
//
// This value is structured like: `my-topic-name`.
string topic_id = 3 [(google.api.field_behavior) = REQUIRED];
}
// Request for GetTopic.
message GetTopicRequest {
// Required. The name of the topic whose configuration to return.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Topic"
}
];
}
// Request for GetTopicPartitions.
message GetTopicPartitionsRequest {
// Required. The topic whose partition information to return.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Topic"
}
];
}
// Response for GetTopicPartitions.
message TopicPartitions {
// The number of partitions in the topic.
int64 partition_count = 1;
}
// Request for ListTopics.
message ListTopicsRequest {
// Required. The parent whose topics are to be listed.
// Structured like `projects/{project_number}/locations/{location}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// The maximum number of topics to return. The service may return fewer than
// this value.
// If unset or zero, all topics for the parent will be returned.
int32 page_size = 2;
// A page token, received from a previous `ListTopics` call.
// Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to `ListTopics` must match
// the call that provided the page token.
string page_token = 3;
}
// Response for ListTopics.
message ListTopicsResponse {
// The list of topic in the requested parent. The order of the topics is
// unspecified.
repeated Topic topics = 1;
// A token that can be sent as `page_token` to retrieve the next page of
// results. If this field is omitted, there are no more results.
string next_page_token = 2;
}
// Request for UpdateTopic.
message UpdateTopicRequest {
// Required. The topic to update. Its `name` field must be populated.
Topic topic = 1 [(google.api.field_behavior) = REQUIRED];
// Required. A mask specifying the topic fields to change.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}
// Request for DeleteTopic.
message DeleteTopicRequest {
// Required. The name of the topic to delete.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Topic"
}
];
}
// Request for ListTopicSubscriptions.
message ListTopicSubscriptionsRequest {
// Required. The name of the topic whose subscriptions to list.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Topic"
}
];
// The maximum number of subscriptions to return. The service may return fewer
// than this value.
// If unset or zero, all subscriptions for the given topic will be returned.
int32 page_size = 2;
// A page token, received from a previous `ListTopicSubscriptions` call.
// Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to `ListTopicSubscriptions`
// must match the call that provided the page token.
string page_token = 3;
}
// Response for ListTopicSubscriptions.
message ListTopicSubscriptionsResponse {
// The names of subscriptions attached to the topic. The order of the
// subscriptions is unspecified.
repeated string subscriptions = 1;
// A token that can be sent as `page_token` to retrieve the next page of
// results. If this field is omitted, there are no more results.
string next_page_token = 2;
}
// Request for CreateSubscription.
message CreateSubscriptionRequest {
// Required. The parent location in which to create the subscription.
// Structured like `projects/{project_number}/locations/{location}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// Required. Configuration of the subscription to create. Its `name` field is ignored.
Subscription subscription = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The ID to use for the subscription, which will become the final component
// of the subscription's name.
//
// This value is structured like: `my-sub-name`.
string subscription_id = 3 [(google.api.field_behavior) = REQUIRED];
}
// Request for GetSubscription.
message GetSubscriptionRequest {
// Required. The name of the subscription whose configuration to return.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Subscription"
}
];
}
// Request for ListSubscriptions.
message ListSubscriptionsRequest {
// Required. The parent whose subscriptions are to be listed.
// Structured like `projects/{project_number}/locations/{location}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// The maximum number of subscriptions to return. The service may return fewer
// than this value.
// If unset or zero, all subscriptions for the parent will be returned.
int32 page_size = 2;
// A page token, received from a previous `ListSubscriptions` call.
// Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to `ListSubscriptions` must
// match the call that provided the page token.
string page_token = 3;
}
// Response for ListSubscriptions.
message ListSubscriptionsResponse {
// The list of subscriptions in the requested parent. The order of the
// subscriptions is unspecified.
repeated Subscription subscriptions = 1;
// A token that can be sent as `page_token` to retrieve the next page of
// results. If this field is omitted, there are no more results.
string next_page_token = 2;
}
// Request for UpdateSubscription.
message UpdateSubscriptionRequest {
// Required. The subscription to update. Its `name` field must be populated.
// Topic field must not be populated.
Subscription subscription = 1 [(google.api.field_behavior) = REQUIRED];
// Required. A mask specifying the subscription fields to change.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}
// Request for DeleteSubscription.
message DeleteSubscriptionRequest {
// Required. The name of the subscription to delete.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Subscription"
}
];
}

View File

@ -0,0 +1,188 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.pubsublite.v1;
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.cloud.pubsublite.proto";
// The values associated with a key of an attribute.
message AttributeValues {
// The list of values associated with a key.
repeated bytes values = 1;
}
// A message that is published by publishers and delivered to subscribers.
message PubSubMessage {
// The key used for routing messages to partitions or for compaction (e.g.,
// keep the last N messages per key). If the key is empty, the message is
// routed to an arbitrary partition.
bytes key = 1;
// The payload of the message.
bytes data = 2;
// Optional attributes that can be used for message metadata/headers.
map<string, AttributeValues> attributes = 3;
// An optional, user-specified event time.
google.protobuf.Timestamp event_time = 4;
}
// A cursor that describes the position of a message within a topic partition.
message Cursor {
// The offset of a message within a topic partition. Must be greater than or
// equal 0.
int64 offset = 1;
}
message SequencedMessage {
// The position of a message within the partition where it is stored.
Cursor cursor = 1;
// The time when the message was received by the server when it was first
// published.
google.protobuf.Timestamp publish_time = 2;
// The user message.
PubSubMessage message = 3;
// The size in bytes of this message for flow control and quota purposes.
int64 size_bytes = 4;
}
// Metadata about a topic resource.
message Topic {
option (google.api.resource) = {
type: "pubsublite.googleapis.com/Topic"
pattern: "projects/{project}/locations/{location}/topics/{topic}"
};
// The settings for a topic's partitions.
message PartitionConfig {
// The number of partitions in the topic. Must be at least 1.
int64 count = 1;
// Every partition in the topic is allocated throughput equivalent to
// `scale` times the standard partition throughput (4 MiB/s). This is also
// reflected in the cost of this topic; a topic with `scale` of 2 and count
// of 10 is charged for 20 partitions. This value must be in the range
// [1,4].
int32 scale = 2;
}
// The settings for a topic's message retention.
message RetentionConfig {
// The provisioned storage, in bytes, per partition. If the number of bytes
// stored in any of the topic's partitions grows beyond this value, older
// messages will be dropped to make room for newer ones, regardless of the
// value of `period`.
int64 per_partition_bytes = 1;
// How long a published message is retained. If unset, messages will be
// retained as long as the bytes retained for each partition is below
// `per_partition_bytes`.
google.protobuf.Duration period = 2;
}
// The name of the topic.
// Structured like:
// projects/{project_number}/locations/{location}/topics/{topic_id}
string name = 1;
// The settings for this topic's partitions.
PartitionConfig partition_config = 2;
// The settings for this topic's message retention.
RetentionConfig retention_config = 3;
}
// Metadata about a subscription resource.
message Subscription {
option (google.api.resource) = {
type: "pubsublite.googleapis.com/Subscription"
pattern: "projects/{project}/locations/{location}/subscriptions/{subscription}"
};
// The settings for a subscription's message delivery.
message DeliveryConfig {
// When this subscription should send messages to subscribers relative to
// messages persistence in storage.
enum DeliveryRequirement {
// Default value. This value is unused.
DELIVERY_REQUIREMENT_UNSPECIFIED = 0;
// The server does not wait for a published message to be successfully
// written to storage before delivering it to subscribers. As such, a
// subscriber may receive a message for which the write to storage failed.
// If the subscriber re-reads the offset of that message later on (e.g.,
// after a `Seek` operation), there may be a gap at that offset. Even if
// not re-reading messages, the delivery of messages for which the write
// to storage fails may be inconsistent across subscriptions, with some
// receiving the message (e.g., those connected at the time the message is
// published) and others not receiving it (e.g., those disconnected at
// publish time). Note that offsets are never reused, so even if
// DELIVER_IMMEDIATELY is used, subscribers will not receive different
// messages when re-reading, they will just see gaps. EXAMPLE:
// (0) Topic 'topic1' is created with a single partition.
// (1) Two subscriptions 'sub1' and 'sub2' are created on topic1. sub1
// has 'DELIVER_IMMEDIATELY', sub2 has 'DELIVER_AFTER_STORED'.
// (2) A stream is opened for sub1 but not sub2.
// (3) A stream is opened for a publisher client using pub1.
// (4) pub1 successfully publishes m0 at offset 0 and m0 is delivered to
// sub1.
// (5) pub1 publishes m1 at offset 1 and m1 is delivered to sub1 but the
// write to storage fails (their stream then breaks).
// (6) A stream is reopened for pub1.
// (6) pub1 successfully publishes m2 at offset 2 and m2 is delivered to
// sub1.
// (some time elapses...)
// (7) A stream is opened for sub2 and it receives m0 and m2 but not m1.
// (8) sub1 seeks to offset 1 but only receives m2 and not m1.
DELIVER_IMMEDIATELY = 1;
// The server will not deliver a published message to subscribers until
// the message has been successfully written to storage. This will result
// in higher end-to-end latency, but consistent delivery.
DELIVER_AFTER_STORED = 2;
}
// The DeliveryRequirement for this subscription.
DeliveryRequirement delivery_requirement = 3;
}
// The name of the subscription.
// Structured like:
// projects/{project_number}/locations/{location}/subscriptions/{subscription_id}
string name = 1;
// The name of the topic this subscription is attached to.
// Structured like:
// projects/{project_number}/locations/{location}/topics/{topic_id}
string topic = 2 [(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Topic"
}];
// The settings for this subscription's message delivery.
DeliveryConfig delivery_config = 3;
}

View File

@ -0,0 +1,169 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.pubsublite.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/pubsublite/v1/common.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite";
option java_multiple_files = true;
option java_outer_classname = "CursorProto";
option java_package = "com.google.cloud.pubsublite.proto";
// 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.
service CursorService {
option (google.api.default_host) = "pubsublite.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
// Establishes a stream with the server for managing committed cursors.
rpc StreamingCommitCursor(stream StreamingCommitCursorRequest) returns (stream StreamingCommitCursorResponse) {
}
// Updates the committed cursor.
rpc CommitCursor(CommitCursorRequest) returns (CommitCursorResponse) {
}
// Returns all committed cursor information for a subscription.
rpc ListPartitionCursors(ListPartitionCursorsRequest) returns (ListPartitionCursorsResponse) {
option (google.api.http) = {
get: "/v1/cursor/{parent=projects/*/locations/*/subscriptions/*}/cursors"
};
option (google.api.method_signature) = "parent";
}
}
// The first streaming request that must be sent on a newly-opened stream. The
// client must wait for the response before sending subsequent requests on the
// stream.
message InitialCommitCursorRequest {
// The subscription for which to manage committed cursors.
string subscription = 1;
// The partition for which to manage committed cursors. Partitions are zero
// indexed, so `partition` must be in the range [0, topic.num_partitions).
int64 partition = 2;
}
// Response to an InitialCommitCursorRequest.
message InitialCommitCursorResponse {
}
// Streaming request to update the committed cursor. Subsequent
// SequencedCommitCursorRequests override outstanding ones.
message SequencedCommitCursorRequest {
// The new value for the committed cursor.
Cursor cursor = 1;
}
// Response to a SequencedCommitCursorRequest.
message SequencedCommitCursorResponse {
// The number of outstanding SequencedCommitCursorRequests acknowledged by
// this response. Note that SequencedCommitCursorRequests are acknowledged in
// the order that they are received.
int64 acknowledged_commits = 1;
}
// A request sent from the client to the server on a stream.
message StreamingCommitCursorRequest {
oneof request {
// Initial request on the stream.
InitialCommitCursorRequest initial = 1;
// Request to commit a new cursor value.
SequencedCommitCursorRequest commit = 2;
}
}
// Response to a StreamingCommitCursorRequest.
message StreamingCommitCursorResponse {
oneof request {
// Initial response on the stream.
InitialCommitCursorResponse initial = 1;
// Response to committing a new cursor value.
SequencedCommitCursorResponse commit = 2;
}
}
// Request for CommitCursor.
message CommitCursorRequest {
// The subscription for which to update the cursor.
string subscription = 1;
// The partition for which to update the cursor. Partitions are zero indexed,
// so `partition` must be in the range [0, topic.num_partitions).
int64 partition = 2;
// The new value for the committed cursor.
Cursor cursor = 3;
}
// Response for CommitCursor.
message CommitCursorResponse {
}
// Request for ListPartitionCursors.
message ListPartitionCursorsRequest {
// Required. The subscription for which to retrieve cursors.
// Structured like
// `projects/{project_number}/locations/{location}/subscriptions/{subscription_id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "pubsublite.googleapis.com/Subscription"
}
];
// The maximum number of cursors to return. The service may return fewer than
// this value.
// If unset or zero, all cursors for the parent will be returned.
int32 page_size = 2;
// A page token, received from a previous `ListPartitionCursors` call.
// Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to `ListPartitionCursors`
// must match the call that provided the page token.
string page_token = 3;
}
// A pair of a Cursor and the partition it is for.
message PartitionCursor {
// The partition this is for.
int64 partition = 1;
// The value of the cursor.
Cursor cursor = 2;
}
// Response for ListPartitionCursors
message ListPartitionCursorsResponse {
// The partition cursors from this request.
repeated PartitionCursor partition_cursors = 1;
// A token, which can be sent as `page_token` to retrieve the next page.
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2;
}

View File

@ -0,0 +1,95 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.pubsublite.v1;
import "google/cloud/pubsublite/v1/common.proto";
import "google/api/client.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite";
option java_multiple_files = true;
option java_outer_classname = "PublisherProto";
option java_package = "com.google.cloud.pubsublite.proto";
// 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`).
service PublisherService {
option (google.api.default_host) = "pubsublite.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
// 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.
rpc Publish(stream PublishRequest) returns (stream PublishResponse) {
}
}
// The first request that must be sent on a newly-opened stream.
message InitialPublishRequest {
// The topic to which messages will be written.
string topic = 1;
// The partition within the topic to which messages will be written.
// Partitions are zero indexed, so `partition` must be in the range [0,
// topic.num_partitions).
int64 partition = 2;
}
// Response to an InitialPublishRequest.
message InitialPublishResponse {
}
// Request to publish messages to the topic.
message MessagePublishRequest {
repeated PubSubMessage messages = 1;
}
// Response to a MessagePublishRequest.
message MessagePublishResponse {
// The cursor of the first published message in the batch. The cursors for any
// remaining messages in the batch are guaranteed to be sequential.
Cursor start_cursor = 1;
}
// Request sent from the client to the server on a stream.
message PublishRequest {
oneof request_type {
// Initial request on the stream.
InitialPublishRequest initial_request = 1;
// Request to publish messages.
MessagePublishRequest message_publish_request = 2;
}
}
// Response to a PublishRequest.
message PublishResponse {
oneof response_type {
// Initial response on the stream.
InitialPublishResponse initial_response = 1;
// Response to publishing messages.
MessagePublishResponse message_response = 2;
}
}

View File

@ -0,0 +1,29 @@
type: google.api.Service
config_version: 3
name: pubsublite.googleapis.com
title: Pub/Sub Lite API
apis:
- name: google.cloud.pubsublite.v1.AdminService
- name: google.cloud.pubsublite.v1.CursorService
- name: google.cloud.pubsublite.v1.PublisherService
- name: google.cloud.pubsublite.v1.SubscriberService
authentication:
rules:
- selector: 'google.cloud.pubsublite.v1.AdminService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: 'google.cloud.pubsublite.v1.CursorService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: google.cloud.pubsublite.v1.PublisherService.Publish
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: google.cloud.pubsublite.v1.SubscriberService.Subscribe
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform

View File

@ -0,0 +1,140 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.pubsublite.v1;
import "google/cloud/pubsublite/v1/common.proto";
import "google/api/client.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite";
option java_multiple_files = true;
option java_outer_classname = "SubscriberProto";
option java_package = "com.google.cloud.pubsublite.proto";
// The service that a subscriber client application uses to receive messages
// from subscriptions.
service SubscriberService {
option (google.api.default_host) = "pubsublite.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
// Establishes a stream with the server for receiving messages.
rpc Subscribe(stream SubscribeRequest) returns (stream SubscribeResponse) {
}
}
// The first request that must be sent on a newly-opened stream. The client must
// wait for the response before sending subsequent requests on the stream.
message InitialSubscribeRequest {
// The subscription from which to receive messages.
string subscription = 1;
// The partition from which to receive messages. Partitions are zero indexed,
// so `partition` must be in the range [0, topic.num_partitions).
int64 partition = 2;
}
// Response to an InitialSubscribeRequest.
message InitialSubscribeResponse {
// The cursor from which the subscriber will start receiving messages once
// flow control tokens become available.
Cursor cursor = 1;
}
// Request to update the stream's delivery cursor based on the given target.
// Resets the server available tokens to 0. SeekRequests may not be sent while
// another SeekRequest is outstanding (i.e., has not received a SeekResponse) on
// the same stream. SeekRequests past head result in stream breakage.
message SeekRequest {
// A special target in the partition that takes no other parameters.
enum NamedTarget {
// Default value. This value is unused.
NAMED_TARGET_UNSPECIFIED = 0;
// A target corresponding to the most recently published message in the
// partition.
HEAD = 1;
// A target corresponding to the committed cursor for the given subscription
// and topic partition.
COMMITTED_CURSOR = 2;
}
// The target to seek to. Must be set.
oneof target {
// A named target.
NamedTarget named_target = 1;
// A target corresponding to the cursor, pointing to anywhere in the
// topic partition.
Cursor cursor = 2;
}
}
// Response to a SeekRequest.
message SeekResponse {
// The new delivery cursor for the current stream.
Cursor cursor = 1;
}
// Request to grant tokens to the server, requesting delivery of messages when
// they become available.
message FlowControlRequest {
// The number of message tokens to grant. Must be greater than or equal to 0.
int64 allowed_messages = 1;
// The number of byte tokens to grant. Must be greater than or equal to 0.
int64 allowed_bytes = 2;
}
// A request sent from the client to the server on a stream.
message SubscribeRequest {
oneof request {
// Initial request on the stream.
InitialSubscribeRequest initial = 1;
// Request to update the stream's delivery cursor.
SeekRequest seek = 2;
// Request to grant tokens to the server,
FlowControlRequest flow_control = 3;
}
}
// Response containing a list of messages. Upon delivering a MessageResponse to
// the client, the server:
// * Updates the stream's delivery cursor to one greater than the cursor of the
// last message in the list.
// * Subtracts the total number of bytes and messages from the tokens available
// to the server.
message MessageResponse {
// Messages from the topic partition.
repeated SequencedMessage messages = 1;
}
// Response to SubscribeRequest.
message SubscribeResponse {
oneof response {
// Initial response on the stream.
InitialSubscribeResponse initial = 1;
// Response to a Seek operation.
SeekResponse seek = 2;
// Response containing messages from the topic partition.
MessageResponse messages = 3;
}
}