mirror of
https://github.com/lingble/talos.git
synced 2025-12-15 03:57:06 +00:00
feat: Add time api to apid
This extends apid to cover the time api. Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This commit is contained in:
committed by
Andrew Rynhard
parent
d3d011c8d2
commit
ee24e42319
@@ -12,6 +12,8 @@ import (
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||
grpc "google.golang.org/grpc"
|
||||
|
||||
common "github.com/talos-systems/talos/api/common"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -71,12 +73,10 @@ func (m *TimeRequest) GetServer() string {
|
||||
|
||||
// The response message containing the ntp server, time, and offset
|
||||
type TimeReply struct {
|
||||
Server string `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"`
|
||||
Localtime *timestamp.Timestamp `protobuf:"bytes,2,opt,name=localtime,proto3" json:"localtime,omitempty"`
|
||||
Remotetime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=remotetime,proto3" json:"remotetime,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
Response []*TimeResponse `protobuf:"bytes,1,rep,name=response,proto3" json:"response,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TimeReply) Reset() { *m = TimeReply{} }
|
||||
@@ -108,21 +108,74 @@ func (m *TimeReply) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_TimeReply proto.InternalMessageInfo
|
||||
|
||||
func (m *TimeReply) GetServer() string {
|
||||
func (m *TimeReply) GetResponse() []*TimeResponse {
|
||||
if m != nil {
|
||||
return m.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type TimeResponse struct {
|
||||
Metadata *common.NodeMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
Server string `protobuf:"bytes,2,opt,name=server,proto3" json:"server,omitempty"`
|
||||
Localtime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=localtime,proto3" json:"localtime,omitempty"`
|
||||
Remotetime *timestamp.Timestamp `protobuf:"bytes,4,opt,name=remotetime,proto3" json:"remotetime,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TimeResponse) Reset() { *m = TimeResponse{} }
|
||||
func (m *TimeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*TimeResponse) ProtoMessage() {}
|
||||
func (*TimeResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e7ed1ef5b20ef4ce, []int{2}
|
||||
}
|
||||
|
||||
func (m *TimeResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TimeResponse.Unmarshal(m, b)
|
||||
}
|
||||
|
||||
func (m *TimeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TimeResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
|
||||
func (m *TimeResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TimeResponse.Merge(m, src)
|
||||
}
|
||||
|
||||
func (m *TimeResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_TimeResponse.Size(m)
|
||||
}
|
||||
|
||||
func (m *TimeResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TimeResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TimeResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *TimeResponse) GetMetadata() *common.NodeMetadata {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TimeResponse) GetServer() string {
|
||||
if m != nil {
|
||||
return m.Server
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TimeReply) GetLocaltime() *timestamp.Timestamp {
|
||||
func (m *TimeResponse) GetLocaltime() *timestamp.Timestamp {
|
||||
if m != nil {
|
||||
return m.Localtime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TimeReply) GetRemotetime() *timestamp.Timestamp {
|
||||
func (m *TimeResponse) GetRemotetime() *timestamp.Timestamp {
|
||||
if m != nil {
|
||||
return m.Remotetime
|
||||
}
|
||||
@@ -130,31 +183,36 @@ func (m *TimeReply) GetRemotetime() *timestamp.Timestamp {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*TimeRequest)(nil), "timeapi.TimeRequest")
|
||||
proto.RegisterType((*TimeReply)(nil), "timeapi.TimeReply")
|
||||
proto.RegisterType((*TimeRequest)(nil), "time.TimeRequest")
|
||||
proto.RegisterType((*TimeReply)(nil), "time.TimeReply")
|
||||
proto.RegisterType((*TimeResponse)(nil), "time.TimeResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("time/time.proto", fileDescriptor_e7ed1ef5b20ef4ce) }
|
||||
|
||||
var fileDescriptor_e7ed1ef5b20ef4ce = []byte{
|
||||
// 272 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x4b, 0xc3, 0x30,
|
||||
0x14, 0xc6, 0x89, 0xca, 0xc6, 0x32, 0x41, 0x08, 0x32, 0x46, 0x3d, 0x38, 0x06, 0xe2, 0x2e, 0x26,
|
||||
0x50, 0x11, 0xc4, 0x9b, 0x15, 0xef, 0x52, 0x76, 0xf2, 0x96, 0x96, 0x67, 0x17, 0x4c, 0x48, 0xd6,
|
||||
0xbc, 0x0a, 0xfd, 0x53, 0xfc, 0x6f, 0x25, 0x49,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5e, 0xaf, 0x1b, 0x85, 0x9b, 0xae, 0xe2, 0xb5, 0x35, 0x02,
|
||||
0xa5, 0xb6, 0xfe, 0xc6, 0xf7, 0x1e, 0xc1, 0xf8, 0x54, 0x09, 0xe9, 0x54, 0xfc, 0x84, 0x6a, 0x14,
|
||||
0xe3, 0xdd, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x53, 0xb0, 0xfa, 0xda, 0x01, 0x00, 0x00,
|
||||
// 332 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4e, 0x32, 0x31,
|
||||
0x14, 0x85, 0x33, 0x3f, 0x84, 0x1f, 0x2e, 0x24, 0xc4, 0x6a, 0x08, 0x19, 0x17, 0x12, 0x12, 0x23,
|
||||
0x1b, 0xa7, 0x06, 0x37, 0x46, 0x57, 0x62, 0x5c, 0x6a, 0xcc, 0xc4, 0x95, 0xbb, 0x32, 0x5c, 0xa1,
|
||||
0x71, 0xca, 0xad, 0xd3, 0x62, 0xc2, 0x4b, 0xfa, 0x4c, 0xa6, 0xed, 0x88, 0x8d, 0x2c, 0xdc, 0x4c,
|
||||
0xa7, 0xf7, 0x9c, 0x33, 0x3d, 0xf9, 0xa6, 0xd0, 0xb7, 0x52, 0x21, 0x77, 0x8f, 0x4c, 0x57, 0x64,
|
||||
0x89, 0x35, 0xdd, 0x7b, 0x7a, 0xbc, 0x24, 0x5a, 0x96, 0xc8, 0xfd, 0x6c, 0xbe, 0x79, 0xe5, 0xa8,
|
||||
0xb4, 0xdd, 0x06, 0x4b, 0x7a, 0xf2, 0x5b, 0x74, 0x11, 0x63, 0x85, 0xd2, 0xb5, 0xe1, 0xb0, 0x20,
|
||||
0xa5, 0x68, 0xcd, 0xc3, 0x12, 0x86, 0xe3, 0x53, 0xe8, 0x3e, 0x4b, 0x85, 0x39, 0xbe, 0x6f, 0xd0,
|
||||
0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x37,
|
||||
0x5b, 0x63, 0x51, 0x99, 0xb0, 0xe3, 0x42, 0x4b, 0x7f, 0x05, 0xe6, 0x2d, 0xdf, 0xea, 0xf2, 0x2b,
|
||||
0x00, 0x00, 0xff, 0xff, 0xa7, 0x62, 0x03, 0x24, 0x55, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -183,7 +241,7 @@ func NewTimeClient(cc *grpc.ClientConn) TimeClient {
|
||||
|
||||
func (c *timeClient) Time(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*TimeReply, error) {
|
||||
out := new(TimeReply)
|
||||
err := c.cc.Invoke(ctx, "/timeapi.Time/Time", in, out, opts...)
|
||||
err := c.cc.Invoke(ctx, "/time.Time/Time", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -192,7 +250,7 @@ func (c *timeClient) Time(ctx context.Context, in *empty.Empty, opts ...grpc.Cal
|
||||
|
||||
func (c *timeClient) TimeCheck(ctx context.Context, in *TimeRequest, opts ...grpc.CallOption) (*TimeReply, error) {
|
||||
out := new(TimeReply)
|
||||
err := c.cc.Invoke(ctx, "/timeapi.Time/TimeCheck", in, out, opts...)
|
||||
err := c.cc.Invoke(ctx, "/time.Time/TimeCheck", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -219,7 +277,7 @@ func _Time_Time_Handler(srv interface{}, ctx context.Context, dec func(interface
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/timeapi.Time/Time",
|
||||
FullMethod: "/time.Time/Time",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TimeServer).Time(ctx, req.(*empty.Empty))
|
||||
@@ -237,7 +295,7 @@ func _Time_TimeCheck_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/timeapi.Time/TimeCheck",
|
||||
FullMethod: "/time.Time/TimeCheck",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TimeServer).TimeCheck(ctx, req.(*TimeRequest))
|
||||
@@ -246,7 +304,7 @@ func _Time_TimeCheck_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
|
||||
var _Time_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "timeapi.Time",
|
||||
ServiceName: "time.Time",
|
||||
HandlerType: (*TimeServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user