deployprogress

This commit is contained in:
2023-10-24 20:08:48 +09:00
parent 64ca01c3a7
commit b6b8aa0794
9 changed files with 300 additions and 115 deletions

View File

@ -382,6 +382,93 @@ func (x *OperationQueryResponse) GetArgs() map[string]string {
return nil
}
type DeployingProgress struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"`
Progress int64 `protobuf:"varint,5,opt,name=progress,proto3" json:"progress,omitempty"`
Total int64 `protobuf:"varint,6,opt,name=total,proto3" json:"total,omitempty"`
}
func (x *DeployingProgress) Reset() {
*x = DeployingProgress{}
if protoimpl.UnsafeEnabled {
mi := &file_protos_operation_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeployingProgress) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeployingProgress) ProtoMessage() {}
func (x *DeployingProgress) ProtoReflect() protoreflect.Message {
mi := &file_protos_operation_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeployingProgress.ProtoReflect.Descriptor instead.
func (*DeployingProgress) Descriptor() ([]byte, []int) {
return file_protos_operation_proto_rawDescGZIP(), []int{5}
}
func (x *DeployingProgress) GetHostname() string {
if x != nil {
return x.Hostname
}
return ""
}
func (x *DeployingProgress) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DeployingProgress) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
func (x *DeployingProgress) GetState() string {
if x != nil {
return x.State
}
return ""
}
func (x *DeployingProgress) GetProgress() int64 {
if x != nil {
return x.Progress
}
return 0
}
func (x *DeployingProgress) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
var File_protos_operation_proto protoreflect.FileDescriptor
var file_protos_operation_proto_rawDesc = []byte{
@ -425,21 +512,35 @@ var file_protos_operation_proto_rawDesc = []byte{
0x37, 0x0a, 0x09, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x4e, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x63,
0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x70,
0x70, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x70, 0x69, 0x6e,
0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x02,
0x12, 0x0b, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x10, 0x03, 0x12, 0x09, 0x0a,
0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x04, 0x32, 0x78, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16,
0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x2b, 0x0a, 0x07, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68,
0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72,
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa5, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x70,
0x6c, 0x6f, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a,
0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f,
0x74, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x2a, 0x4e, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x0b, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a,
0x08, 0x53, 0x74, 0x6f, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52,
0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x74,
0x61, 0x72, 0x74, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x04,
0x32, 0xb1, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e,
0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x17, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x2b,
0x0a, 0x07, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x16, 0x2e, 0x4f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x17, 0x52,
0x65, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x72,
0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x69,
0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70,
0x74, 0x79, 0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -455,7 +556,7 @@ func file_protos_operation_proto_rawDescGZIP() []byte {
}
var file_protos_operation_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_protos_operation_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_protos_operation_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_protos_operation_proto_goTypes = []interface{}{
(ProcessState)(0), // 0: ProcessState
(*VersionAndArgs)(nil), // 1: VersionAndArgs
@ -463,21 +564,24 @@ var file_protos_operation_proto_goTypes = []interface{}{
(*OperationQueryRequest)(nil), // 3: OperationQueryRequest
(*ProcessDescription)(nil), // 4: ProcessDescription
(*OperationQueryResponse)(nil), // 5: OperationQueryResponse
nil, // 6: OperationQueryResponse.ArgsEntry
(*Empty)(nil), // 7: Empty
(*DeployingProgress)(nil), // 6: DeployingProgress
nil, // 7: OperationQueryResponse.ArgsEntry
(*Empty)(nil), // 8: Empty
}
var file_protos_operation_proto_depIdxs = []int32{
1, // 0: DeployedVersions.versions:type_name -> VersionAndArgs
4, // 1: OperationQueryRequest.procs:type_name -> ProcessDescription
2, // 2: OperationQueryRequest.deploys:type_name -> DeployedVersions
0, // 3: ProcessDescription.state:type_name -> ProcessState
6, // 4: OperationQueryResponse.args:type_name -> OperationQueryResponse.ArgsEntry
7, // 4: OperationQueryResponse.args:type_name -> OperationQueryResponse.ArgsEntry
3, // 5: Operation.Query:input_type -> OperationQueryRequest
3, // 6: Operation.Refresh:input_type -> OperationQueryRequest
5, // 7: Operation.Query:output_type -> OperationQueryResponse
7, // 8: Operation.Refresh:output_type -> Empty
7, // [7:9] is the sub-list for method output_type
5, // [5:7] is the sub-list for method input_type
6, // 7: Operation.ReportDeployingProgress:input_type -> DeployingProgress
5, // 8: Operation.Query:output_type -> OperationQueryResponse
8, // 9: Operation.Refresh:output_type -> Empty
8, // 10: Operation.ReportDeployingProgress:output_type -> Empty
8, // [8:11] is the sub-list for method output_type
5, // [5:8] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
@ -550,6 +654,18 @@ func file_protos_operation_proto_init() {
return nil
}
}
file_protos_operation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeployingProgress); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -557,7 +673,7 @@ func file_protos_operation_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_protos_operation_proto_rawDesc,
NumEnums: 1,
NumMessages: 6,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -24,6 +24,7 @@ const _ = grpc.SupportPackageIsVersion7
type OperationClient interface {
Query(ctx context.Context, opts ...grpc.CallOption) (Operation_QueryClient, error)
Refresh(ctx context.Context, in *OperationQueryRequest, opts ...grpc.CallOption) (*Empty, error)
ReportDeployingProgress(ctx context.Context, in *DeployingProgress, opts ...grpc.CallOption) (*Empty, error)
}
type operationClient struct {
@ -74,12 +75,22 @@ func (c *operationClient) Refresh(ctx context.Context, in *OperationQueryRequest
return out, nil
}
func (c *operationClient) ReportDeployingProgress(ctx context.Context, in *DeployingProgress, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/Operation/ReportDeployingProgress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// OperationServer is the server API for Operation service.
// All implementations must embed UnimplementedOperationServer
// for forward compatibility
type OperationServer interface {
Query(Operation_QueryServer) error
Refresh(context.Context, *OperationQueryRequest) (*Empty, error)
ReportDeployingProgress(context.Context, *DeployingProgress) (*Empty, error)
mustEmbedUnimplementedOperationServer()
}
@ -93,6 +104,9 @@ func (UnimplementedOperationServer) Query(Operation_QueryServer) error {
func (UnimplementedOperationServer) Refresh(context.Context, *OperationQueryRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Refresh not implemented")
}
func (UnimplementedOperationServer) ReportDeployingProgress(context.Context, *DeployingProgress) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReportDeployingProgress not implemented")
}
func (UnimplementedOperationServer) mustEmbedUnimplementedOperationServer() {}
// UnsafeOperationServer may be embedded to opt out of forward compatibility for this service.
@ -150,6 +164,24 @@ func _Operation_Refresh_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Operation_ReportDeployingProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeployingProgress)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OperationServer).ReportDeployingProgress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Operation/ReportDeployingProgress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OperationServer).ReportDeployingProgress(ctx, req.(*DeployingProgress))
}
return interceptor(ctx, in, info, handler)
}
// Operation_ServiceDesc is the grpc.ServiceDesc for Operation service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -161,6 +193,10 @@ var Operation_ServiceDesc = grpc.ServiceDesc{
MethodName: "Refresh",
Handler: _Operation_Refresh_Handler,
},
{
MethodName: "ReportDeployingProgress",
Handler: _Operation_ReportDeployingProgress_Handler,
},
},
Streams: []grpc.StreamDesc{
{