talos/api/time/time.proto
Andrey Smirnov 5b7bea2471 feat: use grpc-proxy in apid
This replaces codegen version of apid proxying with
talos-systems/grpc-proxy based version. Proxying is transparent, it
doesn't require exact information about methods and response types. It
requires some common layout response to enhance it properly with node
metadata or errors.

There should be no signifcant changes to the API with the previous
version, but it's worth mentioning a few changes:

1. grpc.ClientConn is established just once per upstream (either local
service or remote apid instance).

2. When called without `-t` (`targets`), apid proxies immediately down
to local service skipping proxying to itself (as before), which results
in empty node metadata in response (before it had local node IP). Might
revert this later to proxy to itself (?).

3. Streaming APIs are now fully supported with multiple targets, but
message definition doesn't contain `ResponseMetadata`, so streaming APIs
are broken now with targets (needs a fix).

4. Errors are now returned as responses with `Error` field set in
`ResponseMetadata`, this requires client library update and `osctl` to
handle it properly.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-11-29 22:57:25 +03:00

34 lines
875 B
Protocol Buffer

syntax = "proto3";
package time;
option go_package = "github.com/talos-systems/talos/api/time";
option java_multiple_files = true;
option java_outer_classname = "TimeApi";
option java_package = "com.time.api";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "common/common.proto";
// The time service definition.
service Time {
rpc Time(google.protobuf.Empty) returns (TimeReply);
rpc TimeCheck(TimeRequest) returns (TimeReply);
}
// The response message containing the ntp server
message TimeRequest { string server = 1; }
// The response message containing the ntp server, time, and offset
message TimeReply {
repeated TimeResponse response = 1;
}
message TimeResponse {
common.ResponseMetadata metadata = 1;
string server = 2;
google.protobuf.Timestamp localtime = 3;
google.protobuf.Timestamp remotetime = 4;
}