deployprogress
This commit is contained in:
@ -31,9 +31,10 @@ import (
|
||||
)
|
||||
|
||||
type clientConfig struct {
|
||||
GrpcAddress string `json:"grpc_server_address"`
|
||||
HttpAddress string `json:"http_server_address"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
GrpcAddress string `json:"grpc_server_address"`
|
||||
HttpAddress string `json:"http_server_address"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
RunNodeExporter bool `json:"run_node_exporter"`
|
||||
}
|
||||
|
||||
func loadClientConfig() (clientConfig, error) {
|
||||
@ -359,13 +360,29 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
||||
logger.Println(err)
|
||||
}
|
||||
} else {
|
||||
if err := hc.deploy(&dr); err == nil {
|
||||
hn, _ := os.Hostname()
|
||||
|
||||
if err := hc.deploy(&dr, func(dp *protos.DeployingProgress) {
|
||||
dp.Hostname = hn
|
||||
dp.Name = dr.Name
|
||||
dp.Version = dr.Version
|
||||
op.ReportDeployingProgress(ctx, dp)
|
||||
}); err == nil {
|
||||
prog := gatherDeployedPrograms(hc.config.StorageRoot, dr.Name)
|
||||
hc.deploys[dr.Name] = prog
|
||||
op.Refresh(ctx, hc.makeOperationQueryRequest())
|
||||
} else {
|
||||
logger.Println(err)
|
||||
}
|
||||
|
||||
op.ReportDeployingProgress(ctx, &protos.DeployingProgress{
|
||||
Hostname: hn,
|
||||
Name: dr.Name,
|
||||
Version: dr.Version,
|
||||
State: "done",
|
||||
Progress: 0,
|
||||
Total: 0,
|
||||
})
|
||||
}
|
||||
|
||||
case shared.Withdraw:
|
||||
@ -467,10 +484,15 @@ func (hc *houstonClient) Start() {
|
||||
}
|
||||
|
||||
reconnCount++
|
||||
|
||||
var err error
|
||||
dialContext, cancelDial := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
client, _ = grpc.DialContext(dialContext, hc.config.GrpcAddress, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
client, err = grpc.DialContext(dialContext, hc.config.GrpcAddress, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
cancelDial()
|
||||
if client != nil {
|
||||
|
||||
if err != nil {
|
||||
logger.Println("grpc.DialContext returns err :", err)
|
||||
} else if client != nil {
|
||||
reconnCount = 0
|
||||
logger.Println("grpc.DialContext succeeded")
|
||||
hc.clientChan <- client
|
||||
|
||||
@ -11,17 +11,19 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
"repositories.action2quare.com/ayo/houston/shared"
|
||||
"repositories.action2quare.com/ayo/houston/shared/protos"
|
||||
|
||||
"golang.org/x/text/encoding/korean"
|
||||
|
||||
"golang.org/x/text/transform"
|
||||
)
|
||||
|
||||
func download(dir string, urlpath string, accessToken string) (target string, err error) {
|
||||
func download(dir string, urlpath string, accessToken string, cb func(int64, int64)) (target string, err error) {
|
||||
logger.Println("start downloading", dir, urlpath)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -54,9 +56,27 @@ func download(dir string, urlpath string, accessToken string) (target string, er
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
_, err = io.Copy(out, resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
cl := resp.Header.Get("Content-Length")
|
||||
totalLength, _ := strconv.ParseInt(cl, 10, 0)
|
||||
totalWritten := int64(0)
|
||||
|
||||
if cb != nil {
|
||||
cb(0, totalLength)
|
||||
}
|
||||
|
||||
for {
|
||||
written, err := io.CopyN(out, resp.Body, 1024*1024)
|
||||
totalWritten += written
|
||||
if cb != nil {
|
||||
cb(totalWritten, totalLength)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
return filepath.ToSlash(out.Name()), nil
|
||||
@ -248,7 +268,7 @@ func (hc *houstonClient) prepareUpdateSelf(req *shared.DeployRequest) (srcdir st
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
fname, err := download(tempdir, hc.makeDownloadUrl(req.Url), req.AccessToken)
|
||||
fname, err := download(tempdir, hc.makeDownloadUrl(req.Url), req.AccessToken, nil)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
@ -282,7 +302,7 @@ func (hc *houstonClient) prepareUpdateSelf(req *shared.DeployRequest) (srcdir st
|
||||
return filepath.ToSlash(tempdir), replacer, err
|
||||
}
|
||||
|
||||
func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
|
||||
func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.DeployingProgress)) error {
|
||||
logger.Println("start deploying")
|
||||
root, err := hc.prepareDeploy(req.Name, req.Version)
|
||||
if err != nil {
|
||||
@ -290,11 +310,25 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
|
||||
}
|
||||
|
||||
// verpath에 배포 시작
|
||||
fname, err := download(root, hc.makeDownloadUrl(req.Url), req.AccessToken)
|
||||
fname, err := download(root, hc.makeDownloadUrl(req.Url), req.AccessToken, func(written int64, total int64) {
|
||||
prog := protos.DeployingProgress{
|
||||
State: "download",
|
||||
Progress: written,
|
||||
Total: total,
|
||||
}
|
||||
cb(&prog)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cb(&protos.DeployingProgress{
|
||||
State: "unzip/untar",
|
||||
Progress: 0,
|
||||
Total: 0,
|
||||
})
|
||||
|
||||
switch path.Ext(fname) {
|
||||
case ".zip":
|
||||
err = unzip(fname)
|
||||
@ -304,7 +338,7 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
|
||||
|
||||
if err == nil && len(req.Config) > 0 {
|
||||
// config.json도 다운로드
|
||||
_, err = download(root, hc.makeDownloadUrl(req.Config), req.AccessToken)
|
||||
_, err = download(root, hc.makeDownloadUrl(req.Config), req.AccessToken, nil)
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
9
client/deploy_test.go
Normal file
9
client/deploy_test.go
Normal file
@ -0,0 +1,9 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDownload(t *testing.T) {
|
||||
download(".", "https://kdcc.action2quare.com/houston/_deploys/game/0.18.186.1/game.zip", "", nil)
|
||||
}
|
||||
@ -441,7 +441,7 @@ func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest,
|
||||
if len(req.Config) > 0 {
|
||||
// config.json를 먼저 다운로드 시도
|
||||
root := proc.cmd.Dir
|
||||
if _, err := download(root, hc.makeDownloadUrl(req.Config), ""); err != nil {
|
||||
if _, err := download(root, hc.makeDownloadUrl(req.Config), "", nil); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
76
main.go
76
main.go
@ -30,79 +30,3 @@ func main() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// func TestOperationServer(t *testing.T) {
|
||||
// hc, err := client.NewClient("192.168.9.32:8080", "http://192.168.9.32/commandcenter")
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// return
|
||||
// }
|
||||
// for i := 0; ; i++ {
|
||||
// hc.SetReportMetrics(map[string]float32{
|
||||
// "count": float32(i),
|
||||
// })
|
||||
// time.Sleep(1300 * time.Millisecond)
|
||||
// }
|
||||
|
||||
// // token, _ := getMicrosoftAuthoizationToken("30330e18-f407-4e35-a6d6-b734b9fe9ee9", "VTr8Q~VBAUAOSmFiHM~bjgszYXBm9nuGBQCk8cLq")
|
||||
// //go func() {
|
||||
// //time.Sleep(2 * time.Second)
|
||||
// // testver := fmt.Sprintf("%d.%d.%d", time.Now().Hour(), time.Now().Minute(), time.Now().Second())
|
||||
|
||||
// // svr.Operation().Deploy(server.MakeDeployRequest(
|
||||
// // common.DeployRequest{
|
||||
// // Name: "warehouse",
|
||||
// // Version: testver,
|
||||
// // Url: "https://actionsquare.s3.ap-northeast-2.amazonaws.com/warehouse.zip?response-content-disposition=inline&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEK7%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLW5vcnRoZWFzdC0yIkcwRQIgeYQKZXvVQsYEZNoWzxSRVjsKHzhq5VhIHVIaLpsUpssCIQCeZn8tfVM9jIjiKp62RPwEnb9oGR8T7apbsnqnntNlJCqGAwiH%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDU0OTY2MjkyMDczOCIMeHddxdoH6Xfz68ZqKtoCwVyCYH45tC7aDBpkl%2FsGRPYlhUVy84h%2FVQx4Bu8hvgu3Y3fYSceAFgFWv%2FE3HpvrHD8AY42UsaHPBCd7tmlyydqnPoOr%2F5rjUCAmHXziGV7oAcO3HIbobbjO1rf3W2tQf7FSGbfPyxFdRhoObRz3sQi%2FcmYLKZWPS9UZRuWOSh2J3HHOoEdAIDq38eYxtVl1OEKxPIjfeJHTzmOOmvoOFBOzrY9HJyABcYxvmtOUvR6469Qf5r%2FTe%2BvuL1NQsYyBKwukcSxHcGbg7t%2BNeDTE%2FUS9lL7VYMEZlhfA1WSADbvAcYEu7cv7MENJ44XmAEHnC6zWIvDNqwK9FCfJrpALIJhbXqv%2FU%2Ft%2B5udZT1TXDDqp1se%2FBRLg8NyplcN4E8z6Qt%2F9pNSm1flhORHJsaPzk2ZfGeqvFvZGv1oBigwA6eJ3WCNl2hHhLkiSBg%2BvFwXA1KxxH9U8Nkl7EjDp7JmhBjqzAqPqVamph2PzNkEszr52GH69m90pjYkNTLM4nwMuGdo1f5%2BOm%2FVloBjBCh6OpTSK3XH67zEMZE0tFQ7qmqu2d69EY8Frt749G3RSNPeKptuIKxhBYF692an9nYUXiVH8OJkey0LDMbwWDaVfSZyOiYr%2FmeiVK0eRdK3C0JGwP%2BT6vUHBL1Agi5MH0dKvmlHwzvl%2BuqArgw7ZdOx%2BJsFHRD%2FqA87B5qPuvxPXkAO5qgwZfUW9MAxdh5hxcc9kNfmryYuVWD1DM%2BvRsRF2TsUqeffucajpQ7lhvN6rspDPMltD3VHFX82Hv12nqU7pHwtNLSO0D43W4JCmOJA8TFqhCkY4zCFDok0lx3x6b8w%2F4GptjvCo1c4HG9LAurTNK8HOb3XkYdmPwKOHaqMNajMsKZoohb0%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230331T060558Z&X-Amz-SignedHeaders=host&X-Amz-Expires=43199&X-Amz-Credential=ASIAX76TWSAROTUEDRGM%2F20230331%2Fap-northeast-2%2Fs3%2Faws4_request&X-Amz-Signature=aa6cc8aac808a066ea0c25e57b3a220cb6b2eb6118f6fb28974cb6e3c34e59d0",
|
||||
// // // AccessToken: token,
|
||||
// // },
|
||||
// // []string{"mountain"},
|
||||
// // ))
|
||||
|
||||
// // time.Sleep(2 * time.Second)
|
||||
// // svr.Operation().Start(server.MakeStartRequest(
|
||||
// // common.StartRequest{
|
||||
// // Name: "warehouse",
|
||||
// // Version: "latest",
|
||||
// // Args: "biglocal.exe -port=8090 -dev",
|
||||
// // },
|
||||
// // []string{"mountain"},
|
||||
// // ))
|
||||
// // time.Sleep(25 * time.Second)
|
||||
// // svr.Operation().Restart(server.MakeRestartRequest(
|
||||
// // common.RestartRequest{
|
||||
// // Name: "warehouse",
|
||||
// // Version: "latest",
|
||||
// // },
|
||||
// // []string{"mountain"},
|
||||
// // ))
|
||||
|
||||
// // time.Sleep(5 * time.Second)
|
||||
// // svr.Operation().Stop(server.MakeStopRequest(
|
||||
// // common.StopRequest{
|
||||
// // Name: "warehouse",
|
||||
// // Version: "latest",
|
||||
// // Pid: 0,
|
||||
// // },
|
||||
// // []string{"mountain"},
|
||||
// // ))
|
||||
|
||||
// // svr.Operation().Upload(server.MakeUploadRequest(
|
||||
// // common.UploadRequest{
|
||||
// // Name: "warehouse",
|
||||
// // Version: "latest",
|
||||
// // Url: "http://localhost",
|
||||
// // Filter: "logs/*.log",
|
||||
// // },
|
||||
// // []string{"mountain"},
|
||||
// // ))
|
||||
// // time.Sleep(5 * time.Second)
|
||||
// // svr.Operation().Withdraw(server.MakeWithdrawRequest(
|
||||
// // common.WithdrawRequest{
|
||||
// // Name: "warehouse",
|
||||
// // Version: testver,
|
||||
// // },
|
||||
// // nil,
|
||||
// // ))
|
||||
// //}()
|
||||
// }
|
||||
|
||||
@ -5,6 +5,7 @@ import "protos/empty.proto";
|
||||
service Operation {
|
||||
rpc Query(stream OperationQueryRequest) returns (stream OperationQueryResponse) {}
|
||||
rpc Refresh(OperationQueryRequest) returns (Empty) {}
|
||||
rpc ReportDeployingProgress(DeployingProgress) returns (Empty) {}
|
||||
}
|
||||
|
||||
message VersionAndArgs {
|
||||
@ -42,4 +43,13 @@ message ProcessDescription {
|
||||
message OperationQueryResponse {
|
||||
string operation = 1;
|
||||
map<string, string> args = 2;
|
||||
}
|
||||
|
||||
message DeployingProgress {
|
||||
string hostname = 1;
|
||||
string name = 2;
|
||||
string version = 3;
|
||||
string state = 4;
|
||||
int64 progress = 5;
|
||||
int64 total = 6;
|
||||
}
|
||||
@ -59,6 +59,20 @@ type hostPool struct {
|
||||
hosts map[string]*hostWithChan
|
||||
}
|
||||
|
||||
type deployingBoard struct {
|
||||
sync.Mutex
|
||||
progs []*protos.DeployingProgress
|
||||
}
|
||||
|
||||
func (db *deployingBoard) clone() (out []*protos.DeployingProgress) {
|
||||
db.Lock()
|
||||
defer db.Unlock()
|
||||
|
||||
out = make([]*protos.DeployingProgress, len(db.progs))
|
||||
copy(out, db.progs)
|
||||
return
|
||||
}
|
||||
|
||||
func (sp *hostPool) regist(desc *protos.OperationQueryRequest) (string, chan *opdef) {
|
||||
sp.Lock()
|
||||
defer sp.Unlock()
|
||||
@ -135,6 +149,7 @@ func (sp *hostPool) query(filter func(*hostWithChan) bool) []*hostWithChan {
|
||||
type operationServer struct {
|
||||
protos.UnimplementedOperationServer
|
||||
hp hostPool
|
||||
db deployingBoard
|
||||
}
|
||||
|
||||
func marshal(argval reflect.Value, output map[string]string) map[string]string {
|
||||
@ -190,6 +205,25 @@ Outer:
|
||||
return nil
|
||||
}
|
||||
|
||||
func (os *operationServer) ReportDeployingProgress(ctx context.Context, dp *protos.DeployingProgress) (*protos.Empty, error) {
|
||||
os.db.Lock()
|
||||
defer os.db.Unlock()
|
||||
|
||||
for i, p := range os.db.progs {
|
||||
if p.Hostname == dp.Hostname && p.Name == dp.Name && p.Version == dp.Version {
|
||||
if dp.State == "done" {
|
||||
os.db.progs = append(os.db.progs[:i], os.db.progs[i+1:]...)
|
||||
} else {
|
||||
os.db.progs[i] = dp
|
||||
}
|
||||
return &protos.Empty{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
os.db.progs = append(os.db.progs, dp)
|
||||
return &protos.Empty{}, nil
|
||||
}
|
||||
|
||||
func (os *operationServer) Refresh(ctx context.Context, desc *protos.OperationQueryRequest) (*protos.Empty, error) {
|
||||
os.hp.refresh(desc)
|
||||
return &protos.Empty{}, nil
|
||||
|
||||
@ -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,
|
||||
},
|
||||
|
||||
@ -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{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user