diff --git a/internal/proto/BUILD b/internal/proto/BUILD index dfa6642f..391910fc 100644 --- a/internal/proto/BUILD +++ b/internal/proto/BUILD @@ -1,4 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_proto_library") +# NOTE: gRPC libraries not needed. proto_library( name = "credential_proto", @@ -35,6 +36,23 @@ proto_library( visibility = ["//location/nearby/presence/proto:__pkg__"], ) +proto_library( + name = "tachyon_proto", + srcs = [ + "duration.proto", + "ice.proto", + "messaging.proto", + "tachyon.proto", + "tachyon_common.proto", + "tachyon_enums.proto", + ], + compatible_with = ["//buildenv/target:non_prod"], + deps = [ + "//frameworks/testing/rpcreplay/processors:rpc_replay_field_option_proto", + "//google/api:annotations", + ], +) + cc_proto_library( name = "metadata_cc_proto", visibility = [ @@ -43,18 +61,6 @@ cc_proto_library( deps = [":metadata_proto"], ) -proto_library( - name = "tachyon_proto", - srcs = [ - "duration.proto", - "ice.proto", - "tachyon.proto", - "tachyon_common.proto", - "tachyon_enums.proto", - ], - compatible_with = ["//buildenv/target:non_prod"], -) - cc_proto_library( name = "tachyon_cc_proto", compatible_with = ["//buildenv/target:non_prod"], diff --git a/internal/proto/duration.proto b/internal/proto/duration.proto index ab1d6b5c..37b606bd 100644 --- a/internal/proto/duration.proto +++ b/internal/proto/duration.proto @@ -14,7 +14,7 @@ syntax = "proto3"; -package nearby.internal.tachyon_proto; +package google.internal.communications.instantmessaging.v1; option optimize_for = LITE_RUNTIME; diff --git a/internal/proto/ice.proto b/internal/proto/ice.proto index 954d7e43..a5834605 100644 --- a/internal/proto/ice.proto +++ b/internal/proto/ice.proto @@ -14,7 +14,7 @@ syntax = "proto3"; -package nearby.internal.tachyon_proto; +package google.internal.communications.instantmessaging.v1; import "internal/proto/duration.proto"; diff --git a/internal/proto/messaging.proto b/internal/proto/messaging.proto new file mode 100644 index 00000000..5be1effc --- /dev/null +++ b/internal/proto/messaging.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; + +package google.internal.communications.instantmessaging.v1; + +import "google/api/annotations.proto"; +import "internal/proto/tachyon.proto"; +import "internal/proto/tachyon_common.proto"; + +service Messaging { + // Send a message through fast-path push only. Neither the sender + // nor the receiver need to be registered with Tachyon, and the + // auth token is not required. + // + // The recipient needs to have an open bind channel to receive push + // messages at the time when this method is called. Otherwise this + // returns a NOT_FOUND error. + // + // This method is for Tachyon Express enabled Apps only. + rpc SendMessageExpress(SendMessageExpressRequest) + returns (SendMessageExpressResponse) { + option (google.api.http) = { + post: "/v1/message:sendExpress" + body: "*" + }; + option security_level = PRIVACY_AND_INTEGRITY; + option deadline = 30.0; + } + + // Open a bind channel to Tachyon server to receive streamed push + // messages. No registration nor auth token is required. + // + // This method is for Tachyon Express enabled Apps only. + rpc ReceiveMessagesExpress(ReceiveMessagesExpressRequest) + returns (stream ReceiveMessagesResponse) { + option (google.api.http) = { + post: "/v1/messages:receiveExpress" + body: "*" + }; + option security_level = PRIVACY_AND_INTEGRITY; + } + + // Echo is used for clients to check the connectivity to the Tachyon backend. + rpc Echo(EchoRequest) returns (EchoResponse) { + option (google.api.http) = { + post: "/v1:echo" + body: "*" + }; + option security_level = PRIVACY_AND_INTEGRITY; + option deadline = 30.0; + } +} diff --git a/internal/proto/tachyon.proto b/internal/proto/tachyon.proto index 42427e6a..f017b196 100644 --- a/internal/proto/tachyon.proto +++ b/internal/proto/tachyon.proto @@ -14,7 +14,7 @@ syntax = "proto3"; -package nearby.internal.tachyon_proto; +package google.internal.communications.instantmessaging.v1; import "internal/proto/ice.proto"; import "internal/proto/tachyon_common.proto"; @@ -53,3 +53,7 @@ message ReceiveMessagesResponse { FastPathReady fast_path_ready = 7; } } + +message SendMessageExpressResponse { + ResponseHeader header = 1; +} diff --git a/internal/proto/tachyon_common.proto b/internal/proto/tachyon_common.proto index bc155c33..5282b9f8 100644 --- a/internal/proto/tachyon_common.proto +++ b/internal/proto/tachyon_common.proto @@ -14,8 +14,9 @@ syntax = "proto3"; -package nearby.internal.tachyon_proto; +package google.internal.communications.instantmessaging.v1; +import "frameworks/testing/rpcreplay/processors/rpc_replay_field_option.proto"; import "internal/proto/tachyon_enums.proto"; option optimize_for = LITE_RUNTIME; @@ -67,6 +68,42 @@ message RequestHeader { Id requester_id = 10; } +// ResponseHeader must be included in all response messages with the field name +// `header`. +// This will make the generated Go types of responses have GetHeader and +// SetHeader funcs, which makes it simple to create a common interface to access +// the header values. +message ResponseHeader { + reserved 3, 102; + + // rpc_global_id holds the global dapper trace id of the request that produced + // this response. + uint64 rpc_global_id = 2 [ + jstype = JS_STRING, + (rpcreplay.processing).rewrite_identifier = "TACHYON_RPC_GLOBAL_ID" + ]; + + // txn_timestamp_usec indicates the timestamp that the response data was read + // at. + int64 txn_timestamp_usec = 4 + [(rpcreplay.processing).rewrite_time = MICROSECONDS]; + + // api_version_warning is set by the server when the ClientInfo in the request + // indicate that the client was built against a API version that is soon to be + // deprecated. Clients should show a UI to the user asking them to update the + // application. + // @deprecated + ApiVersionWarning api_version_warning = 103; +} + +message ApiVersionWarning { + // grumble_at is API version where the server starts to complain. + ApiVersion.Value grumble_at = 1; + + // fail_at is the API version where the server no longer accepts requests. + ApiVersion.Value fail_at = 2; +} + message ClientInfo { // major, minor, point and details carry version information from client. int32 major = 3; @@ -117,3 +154,16 @@ message StreamBody { repeated bytes messages = 1; repeated bytes noop = 15; } + +// Echo request and response for clients to test the network connectivity. +// (== suppress_warning documentation-presence ==) +message EchoRequest { + RequestHeader header = 1; + bytes payload = 2; +} + +// (== suppress_warning documentation-presence ==) +message EchoResponse { + ResponseHeader header = 1; + bytes payload = 2; +} diff --git a/internal/proto/tachyon_enums.proto b/internal/proto/tachyon_enums.proto index 3f72a6ab..0bbf8740 100644 --- a/internal/proto/tachyon_enums.proto +++ b/internal/proto/tachyon_enums.proto @@ -14,7 +14,7 @@ syntax = "proto3"; -package nearby.internal.tachyon_proto; +package google.internal.communications.instantmessaging.v1; option optimize_for = LITE_RUNTIME;