GetDeployingProgress 추가

This commit is contained in:
2023-10-24 21:18:28 +09:00
parent b8c1e97ab8
commit 2985e0fdaf
4 changed files with 12 additions and 17 deletions

View File

@ -5,23 +5,9 @@ import (
"testing" "testing"
) )
func pof2(x int64) (out int64) {
out = 1
org := x
for (x >> 1) > 0 {
out = out << 1
x = x >> 1
}
if org > out {
out = out << 1
}
return
}
func TestDownload(t *testing.T) { func TestDownload(t *testing.T) {
//download(".", "https://kdcc.action2quare.com/houston/_deploys/game/0.18.186.1/game.zip", "", nil) //download(".", "https://kdcc.action2quare.com/houston/_deploys/game/0.18.186.1/game.zip", "", nil)
fmt.Println(pof2(1023)) fmt.Println(pof2(1023, 1024))
fmt.Println(pof2(1024)) fmt.Println(pof2(1024, 1024))
fmt.Println(pof2(1025)) fmt.Println(pof2(1025, 1024))
} }

View File

@ -517,3 +517,7 @@ func (h *houstonHandler) GetLogFileLinks(w http.ResponseWriter, r *http.Request)
enc := json.NewEncoder(w) enc := json.NewEncoder(w)
enc.Encode(out) enc.Encode(out)
} }
func (h *houstonHandler) GetDeployingProgress(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(h.Operation().DeplyingProgress())
}

View File

@ -418,6 +418,10 @@ func (os *operationServer) Hosts() map[string]hostSnapshot {
return os.hp.allHosts() return os.hp.allHosts()
} }
func (os *operationServer) DeplyingProgress() []*protos.DeployingProgress {
return os.db.clone()
}
func newOperationServer() *operationServer { func newOperationServer() *operationServer {
return &operationServer{ return &operationServer{
hp: hostPool{ hp: hostPool{

View File

@ -108,6 +108,7 @@ type Operation interface {
RestartProcess(RestartProcessRequest) RestartProcess(RestartProcessRequest)
Upload(UploadRequest) Upload(UploadRequest)
Hosts() map[string]hostSnapshot Hosts() map[string]hostSnapshot
DeplyingProgress() []*protos.DeployingProgress
} }
func loadServerConfig() serverConfig { func loadServerConfig() serverConfig {